none
How to retrieve from email from Exchange server Mail Account ? RRS feed

  • Question

  • Dear All,

    I get the email in my mail box from hardikramwani@hotmail.com.

    I need to retrieve the from email address but i am unable to get this.

       

    Following is code i am using.

    Folder boundFolder = Folder.Bind(service, WellKnownFolderName.Inbox);
                    FindItemsResults<Item> unreadMessages = boundFolder.FindItems(unreadSearchFilter, itemView);

                    if (unreadMessages != null && unreadMessages.Items != null && unreadMessages.Items.Count > 0)
                    {
                        foreach (EmailMessage message in unreadMessages)
                        {

                            string subject = message.Subject.ToString();
                            string strfromEmail = message.From.Address.ToString(); // I got Error of Object Refrence
                            string strDisplayName = message.From.Name.ToString();

      }
                    }

    How can i retrieve from email using C#? 

    Thanks and regards,

    Hardik Ramwani


    Monday, April 6, 2015 10:24 AM

Answers

All replies