Reputation: 371
I created an app with the Application Permissions MailboxSettings.ReadWrite
.
I then built a Web API to create subscriptions to mailbox folders.
I am successfully able to get the Auth Token and listen to the test notification from the app. But when I try to create a subscription I get the following error:
{
Code: ExtensionError
Message: Operation: Create; Exception: [Status Code: Unauthorized; Reason: Unauthorized]
}
This is how I am creating a subscription:
var subscription = new Subscription
{
Resource = $"users/{CurrentUserId}/mailFolders('Inbox')/messages",
ChangeType = "created,updated",
NotificationUrl = ConfigurationManager.AppSettings["ida:NotificationUrl"],
ClientState = Guid.NewGuid().ToString(),
ExpirationDateTime = DateTime.UtcNow + new TimeSpan(0, 0, 15, 0)
};
var newSubscription = await graphClient.Subscriptions.Request().AddAsync(subscription);
My question is, which permissions does my App need to have create a subscription?
I am using Microsoft Graph access without a user. https://learn.microsoft.com/en-us/graph/auth-v2-service. I want to run my API unattended.
Upvotes: 1
Views: 237