Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
MailboxSettings.ReadWrite
Not available.
Delegated (personal Microsoft account)
MailboxSettings.ReadWrite
Not available.
Application
MailboxSettings.ReadWrite
Not available.
HTTP request
POST /me/outlook/masterCategories
POST /users/{id|userPrincipalName}/outlook/masterCategories
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OutlookCategory
{
DisplayName = "Project expenses",
Color = CategoryColor.Preset9,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Outlook.MasterCategories.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc users outlook master-categories create --user-id {user-id} --body '{\
"displayName": "Project expenses",\
"color": "preset9"\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OutlookCategory outlookCategory = new OutlookCategory();
outlookCategory.setDisplayName("Project expenses");
outlookCategory.setColor(CategoryColor.Preset9);
OutlookCategory result = graphClient.me().outlook().masterCategories().post(outlookCategory);
Import-Module Microsoft.Graph.Users
$params = @{
displayName = "Project expenses"
color = "preset9"
}
# A UPN can also be used as -UserId.
New-MgUserOutlookMasterCategory -UserId $userId -BodyParameter $params
Dostępne już wkrótce: W 2024 r. będziemy stopniowo wycofywać zgłoszenia z serwisu GitHub jako mechanizm przesyłania opinii na temat zawartości i zastępować go nowym systemem opinii. Aby uzyskać więcej informacji, sprawdź: https://aka.ms/ContentUserFeedback.