Exchange Web Services - convert emailitem attachment from Base64 string to Byte gives error

前端 未结 1 1209
一向
一向 2021-01-28 16:16

I am trying to read an email item attachment using EWS and save it to disk as a text file so it can be used later on.

I am getting an error:

\"The input          


        
相关标签:
1条回答
  • 2021-01-28 17:02

    Philip,

    You will not be able to use the Convert() method on an ItemAttachment because it is not Base64 encoded. The item attachment has a lot of properties about the item, and if I understand your request properly you are looking for just the body of the email.

    The first thing you will want to consider is adding a check to see if the ItemAttachment is an email message. If it is, there are couple of lines to get to the text of the email body:

    itemAttachment.Load(new PropertySet(BasePropertySet.FirstClassProperties));
    string BodyText = itemAttachment.Item.Body.Text;
    

    The first line will load the item and it's first class properties. The second line will get the text version of the email body.

    I hope this helps. If this does resolve your question, please mark the post as answered.

    Thanks,

    --- Bob ---

    0 讨论(0)
提交回复
热议问题