IEWSClient FetchAttachment method

Hello,

I'm trying to use the IEWSClient.FetchAttachment method and the string parameter it's asking for is an 'attachmentUri'. Where can the attachmentUri value be found?

I'm using IEWSClient.FetchMessage to retieve an eMail and I see the 'Attchments' collection off of it. I see a property on the Aspose.Email.Mail.Attachment class a property called 'ContentId'. I tried to use the value of 'ContentId' for the attachmentUri parameter but that doesn't work.

I'm connecting to an Exchange 2010 server using Aspose.Email.Exchange version 4.1.0.0

Please let me know.

Thanks!

Hi Mike,

Thank you for using Aspose.Email.

The attachment URI can be retrieved using ListMessages(folder, ExchangeListMessagesOptions.FetchAttachmentInformation) method as shown in the following sample code. Please let us know if we can be of any additional help to you in this regard.

Sample Code:

IEWSClient client = GetAsposeEWSClient1();
ExchangeMessageInfoCollection coll = client.ListMessages("Inbox", ExchangeListMessagesOptions.FetchAttachmentInformation);
foreach (ExchangeMessageInfo msgInfo in coll)
{
    Attachment att = client.FetchAttachment(msgInfo.Attachments[0].AttachmentUri);
    Console.WriteLine(att.Name);
}

Hi Kashif,


Thanks for reply. Basically I see that ListMessage with that extra parameter gives me the meta-data I’m looking for.

One other question:
I see that FetchMessage contains an overload that takes an array of extendedProperties - but I can’t find any definition of what the extendedProperties array can contain. Can you provide any information?

Thanks,
Mike




Hi Mike,


Thank you for sharing the feedback.

At present, I could not find any such information or working example to illustrate the usage of extendedProperties inn FetchMessage and have requested development team’s feedback in this regard. As soon as there is some information available, I’ll update you here via this thread and appreciate your little more patience in this regard.