question

ranirishmawi-6239 avatar image
0 Votes"
ranirishmawi-6239 asked ranirishmawi-6239 edited

Problem modifying email message attachments using MS Graph

Hello experts,

Using MS Graph SDK or MS graph explorer, we are trying to replace an attachment within a message. Updating a message attachment is not supported yet by ms graph API. that's why we do the operation in the following steps:

  1. get the original attachment content.

  2. modify that content.

  3. delete the original attachment.

  4. then add the modified content as a new attachment with the same name.

This works. However, randomly fails, resulting in two attachments the original and the new instead of the message having one updated attachment. the API returns success results in both cases with no indication of what might be the problem.

Here are the calls:

First Request to delete the attachment (step 3):

 DELETE https://graph.microsoft.com/v1.0/me/messages/{messageId}/attachments/{attachmentId}  

Second Request to add the modified attachment (step 4):

 POST https://graph.microsoft.com/v1.0/me/messages/{messageId}/attachments 


body:

 {     
    
 "@odata.type": "#microsoft.graph.fileAttachment",    
    
  "name": "smime.p7m",    
    
  "contentType": "application/x-pkcs7-mime",    
    
  "contentBytes": "{contentBytes}" 
    
 }

Any feedback on what might be causing the issue would be appreciated.



microsoft-graph-sdk
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ranirishmawi-6239 avatar image
0 Votes"
ranirishmawi-6239 answered ranirishmawi-6239 edited

After some research on this, it looks like this is not an issue with ms graph. The thing is that we are using outlook for mobile on IOS to check the message after being manipulated and the outlook app does not update the attachment correctly which results in two attachments being displayed. If we query the message using ms graph explorer we can see that the attachment was replaced correctly. We concluded that this is a bug in Outlook app o IOS.

To confirm, we reinstalled the outlook app on IOS and the message with its attachments was displayed correctly.

Regards

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ranirishmawi-6239 avatar image
0 Votes"
ranirishmawi-6239 answered

Anything on this?

Regards

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.