This call results in a GetAttachment call to EWS.įileAttachment.Load("C:\\temp\\" fileAttachment.Name) Ĭonsole.WriteLine("File attachment name: " fileAttachment.Name) Įlse // Attachment is an item attachment. Iterate through the attachments collection and load each attachment.įoreach (Attachment attachment in message.Attachments) This method results in an GetItem call to EWS.ĮmailMessage message = EmailMessage.Bind(service, itemId, new PropertySet(ItemSchema.Attachments)) Bind to an existing message item and retrieve the attachments collection. Stream stream1 = new MemoryStream(stream) Īnother way is to use EWS Managed API, code below is for your reference: public static void GetAttachmentsFromEmail(ExchangeService service, ItemId itemId) Var stream = fileAttachment.ContentBytes ![]() Var attachments = įileAttachment fileAttachment = attachment as FileAttachment ![]() : var messages = await outlookServicesClient.Me.Folders.Messagesįoreach (var message in messages.CurrentPage) You could firstly get the attachment of the message with api, and save the file attachment to a local file (item attachment couldn’t be saved to local file),code below is for your reference To answer your first question, you could use c# to achieve that.
0 Comments
Leave a Reply. |