How to create a nested attachments inside a top level outlook item attachment?

Mohd Ahsan 0 Reputation points
2024-07-08T14:31:23.71+00:00

Hi,

I am facing issues while trying to create the nested file / outlook item attachments using MS Graph API.

Example - I am trying to create a mail which has a top level mail item attachment and another mail item attachment inside the top level attachment. The nested attachment may have another file or item attachment.

When I create the mail using this POST API,

POST /users/{id | userPrincipalName}/mailFolders/{id}/childFolders/{id}/messages/

It creates the mail and only top level attachment.

It does not create any nested attachment and returns 200 response.

Also, another API provided in the documentation https://learn.microsoft.com/en-us/graph/api/message-post-attachments?view=graph-rest-1.0&tabs=http#http-request

does not work.

POST /users/{id | userPrincipalName}/mailFolders/{id}/childFolders/{id}/messages/{id}/attachments/{id}

{
    "error": {
        "code": "ErrorInvalidRequest",
        "message": "The OData request is not supported."
    }
}

Please help. If I am missing something from the documentation or there is another way to achieve what I require, please let me know.

We may as well connect over a call. Please let me know on my mail.

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.