.NET Components for Mobility

attachment.save second run returns null reference

Last post 07-10-2008 7:09 AM by PeterFoot. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-08-2008 1:21 PM

    • navin
    • Top 500 Contributor
    • Joined on 07-02-2008
    • Posts 2

    attachment.save second run returns null reference

    HI,

    I am trying to retrieve attachments from the emails. Below is sample code

    foreach (EmailAccount ea in session.EmailAccounts)

    {

    string AccountName = ea.Name;

    EmailMessageFolder inbox = ea.Inbox;if (inbox != null)

    {

    foreach (EmailMessage msg in inbox)

    {

    foreach (Attachment attachment in msg.Attachments)

    {

    attachment.Save("Hello.txt");

    }

    }

    }

     

    This works fine with the first run. But if i execute this code again without exiting the application then then attachment.Save is throwing NULL reference exception.

     

    Any help will be useful.

    Thanks,

    Navin

  • 07-10-2008 7:09 AM In reply to

    Re: attachment.save second run returns null reference

    I will take a look into the code and see what is happening. I'll post back with more news.

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
Page 1 of 1 (2 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.