You cannot grant graph permissions while creating an application, you can only grant graph permissions to an application after it has been created.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var application = new Application
{
RequiredResourceAccess = new List<RequiredResourceAccess>()
{
new RequiredResourceAccess
{
ResourceAppId = "00000003-0000-0000-c000-000000000000",
ResourceAccess = new List<ResourceAccess>()
{
new ResourceAccess
{
Id = Guid.Parse("7427e0e9-2fba-42fe-b0c0-848c9e6a8182"),
Type = "Scope"
},
new ResourceAccess
{
Id = Guid.Parse("37f7f235-527c-4136-accd-4a02d197296e"),
Type = "Scope"
}
}
}
}
};
await graphClient.Applications["{app object id}"]
.Request()
.UpdateAsync(application);
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.