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://video2.skills-academy.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 Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,005 questions
0 comments No comments
{count} votes

Your answer

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