Microsoft Security | Microsoft Graph
An API that connects multiple Microsoft services, enabling data access and automation across platforms
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).