Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,015 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Using Graph API in C#, we are trying to create a child folder inside Inbox folder for a user's email.
Following is the code snippet for the same:
var newMailFolder = new MailFolder
{
DisplayName = mailboxName,
IsHidden = false
};
mailFolder = _gsc.Users[_outlookUser.Id].MailFolders["inbox"].ChildFolders.Request().AddAsync(mailFolder).Result;
This always throws the following exception:
Write requests (excluding DELETE) must contain the Content-Type header declaration
Can someone please help ASAP?
Maybe replace AddAsync(mailFolder) with AddAsync(newMailFolder).