Hi
I am trying to integrate Universal Print with the Microsoft Graph API in a .NET Core Web API application.
I have Azure Subscription and enable Universal Print on my Azure tenant and registered printer in Universal Print.
Registered application in the Azure portal and added the necessary Delegated and Application permissions (e.g., PrintJob.ReadWrite, Printer.ReadWrite.All) with Grant Admin Consent under Microsoft Graph API.
I am getting "the token does not have one or more required security scopes" at below code.
I have decrypted the token by using jwt.ms and observed that I have sufficient roles those are: "roles": [ "Files.ReadWrite.AppFolder", "Printer.Read.All", "Printer.ReadWrite.All", "PrintJob.Manage.All", "PrintJob.ReadWriteBasic.All", "PrintJob.Read.All", "PrintSettings.Read.All", "PrintJob.ReadWrite.All", "Files.ReadWrite.All", "Files.Read.All", "PrintTaskDefinition.ReadWrite.All", "PrintJob.ReadBasic.All" ] Still I am getting the error.
var res = await _graphServiceClient.Print.Printers[pId].Jobs.PostAsync(pjob);
I am able to make it work this by using .Net Core Web App OpenIDConnect approach and it is pulling Delegated Permissions as scope, and it is asking user consent when running the application.
I would like to make it work with "Application Permissions" (app-only) because this will run in the background as Web API and from my org multiple users will give print request and every time, we could not ask user consent.
I went through the Microsoft Graph API and Universal Print documentation and tried in AI tools but unfortunately, I could not find a way to do this by using Application Permissions in WEB API.
If anyone suggest an approach or solutions that would be appreciated.
Thanks,
Suresh