Integration, failing on createUploadSession call

%3CLINGO-SUB%20id%3D%22lingo-sub-1837703%22%20slang%3D%22en-US%22%3EIntegration%2C%20failing%20on%20createUploadSession%20call%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1837703%22%20slang%3D%22en-US%22%3E%3CP%3EHello.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EImplementing%20against%20universal%20print%20graph%20api.%3C%2FP%3E%3CP%3EHave%20so%20far%20got%20result%20for%3C%2FP%3E%3CP%3E-%20getting%20print%20shares%20using%20%3A%26nbsp%3B%3CSPAN%3Eprint%2Fshares%3F%24select%3Did%2Cname%2Cdefaults%2Ccapabilities%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E-%20creating%20printer%20job%20%3A%26nbsp%3Bprint%2Fshares%2F%3CSPAN%20class%3D%22resolvedVariable%22%3E%7B%7BPrinterId%7D%7D%3C%2FSPAN%3E%2Fjobs%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Eand%20now%20I'm%20stuck%20with%26nbsp%3B%3CSTRONG%3EcreateUploadSession%3C%2FSTRONG%3E%20call%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E-%20print%2Fshares%2F%3CSPAN%20class%3D%22resolvedVariable%22%3E%7B%7BPrinterId%7D%7D%3C%2FSPAN%3E%2Fjobs%2F%3CSPAN%20class%3D%22resolvedVariable%22%3E%7B%7BJobId%7D%7D%3C%2FSPAN%3E%2Fdocuments%2F%3CSPAN%20class%3D%22resolvedVariable%22%3E%7B%7BDocumentId%7D%7D%3C%2FSPAN%3E%2FcreateUploadSession%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EBased%20on%3C%2FSPAN%3E%3C%2FP%3E%3CDIV%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fprintdocument-createuploadsession%3Fview%3Dgraph-rest-beta%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fprintdocument-createuploadsession%3Fview%3Dgraph-rest-beta%3C%2FA%3E%26nbsp%3BI%20need%20to%20have%26nbsp%3B%3CSPAN%3E%3CSPAN%3EPrintJob.ReadWrite.All%20permission%2C%20which%20I%20have%26nbsp%3B%20(including%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3EPrinter.ReadWrite.All)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ebut%20when%20I%20try%20POST%20request%20with%20body%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22documentName%22%3A%20%22example.pdf%22%2C%0A%20%20%20%20%20%20%20%20%22contentType%22%3A%20%22application%2Fpdf%22%2C%0A%20%20%20%20%20%20%20%20%22size%22%3A%20144547%0A%20%20%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethen%20I%20keep%20getting%20%22%3CSPAN%3E%3CSPAN%3EUnknownError%20-%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3EThe%20token%20does%20not%20have%20one%20or%20more%20required%20security%20scopes%22%2C%20i.e.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%20%20%22error%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22code%22%3A%20%22UnknownError%22%2C%0A%20%20%20%20%20%20%20%20%22message%22%3A%20%22%5C%22The%20token%20does%20not%20have%20one%20or%20more%20required%20security%20scopes.%5C%22%22%2C%0A%20%20%20%20%20%20%20%20%22innerError%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22date%22%3A%20%222020-10-30T14%3A48%3A12%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22request-id%22%3A%20%229b6e5a98-2b38-428c-9175-335bfce3feee%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22client-request-id%22%3A%20%229b6e5a98-2b38-428c-9175-335bfce3feee%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ewhat%20are%20those%20%22security%20scopes%22%20what%20it%20is%20after%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUnfortunately%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Funiversalprint-react-sample%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Esample%20app%3C%2FA%3E%20is%20outdate%20so%20this%20doesn't%20even%20use%20this%20call.%20Sample%20app%20is%20using%20deprecated%26nbsp%3B%3CEM%3Eprint%2Fshares%2F%3CSPAN%20class%3D%22resolvedVariable%22%3E%7B%7BPrinterId%7D%7D%3C%2FSPAN%3E%2Fjobs%2F%3CSPAN%20class%3D%22resolvedVariable%22%3E%7B%7BJobId%7D%7D%3C%2FSPAN%3E%2Fdocuments%2F%3CSPAN%20class%3D%22resolvedVariable%22%3E%7B%7BDocumentId%7D%7D%3C%2FSPAN%3E%3C%2FEM%3E%3CSPAN%3E%3CEM%3E%2FuploadData%3C%2FEM%3E%20call%2C%20so%20no%20hints%20there.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EDoes%20anyone%20know%20solution%20for%20this%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1843486%22%20slang%3D%22en-US%22%3ERe%3A%20Integration%2C%20failing%20on%20createUploadSession%20call%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1843486%22%20slang%3D%22en-US%22%3E%3CP%3EGot%20reply%20on%20my%20question%20in%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Fmicrosoft-graph-docs%2Fissues%2F10486%23issuecomment-719839157%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Fmicrosoft-graph-docs%2Fissues%2F10486%23issuecomment-719839157%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethat%20I%20would%20need%20also%20%3CSTRONG%3EPrinterShare.ReadWrite.All%3C%2FSTRONG%3E%20permission.%20This%20got%20further%20from%20this%20initial%20error%20message%20to%20next%20-%20seems%20application%2Fpdf%20is%20not%20supported%20%3AS%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EUnsupported%20document-format%3A%20application%2Fpdf.%20Supported%20formats%3A%20Attribute%20document-format-supported%3A%20SimpleIppValue-Type%3AMimeMediaType-Value%3Aapplication%2Foxps%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello.

 

Implementing against universal print graph api.

Have so far got result for

- getting print shares using :

print/shares?$select=id,name,defaults,capabilities

- creating printer job :

print/shares/%%PrinterId%%/jobs

 

and now I'm stuck with createUploadSession call:

print/shares/%%PrinterId%%/jobs/%%JobId%%/documents/%%DocumentId%%/createUploadSession

 

Based on

https://docs.microsoft.com/en-us/graph/api/printdocument-createuploadsession?view=graph-rest-beta I need to have PrintJob.ReadWrite.All permission, which I have  (including 
Printer.ReadWrite.All)
 
but when I try POST request with body

 

 

 

{
    "properties": {
        "documentName": "example.pdf",
        "contentType": "application/pdf",
        "size": 144547
    }
}

 

 

then I keep getting "UnknownError - The token does not have one or more required security scopes", i.e.

 

 

 

{
    "error": {
        "code": "UnknownError",
        "message": "\"The token does not have one or more required security scopes.\"",
        "innerError": {
            "date": "2020-10-30T14:48:12",
            "request-id": "9b6e5a98-2b38-428c-9175-335bfce3feee",
            "client-request-id": "9b6e5a98-2b38-428c-9175-335bfce3feee"
        }
    }
}

 

 

 

 

 

what are those "security scopes" what it is after?

 

Unfortunately sample app is outdate so this doesn't even use this call. Sample app is using deprecated call 

print/shares/%%PrinterId%%/jobs/%%JobId%%/documents/%%DocumentId%%/uploadData

so no hints there.

 

Does anyone know solution for this?

Thanks!

1 Reply

Got reply on my question in https://github.com/microsoftgraph/microsoft-graph-docs/issues/10486#issuecomment-719839157

 

that I would need also PrinterShare.ReadWrite.All permission. This got further from this initial error message to next - seems application/pdf is not supported :S

 

Unsupported document-format: application/pdf.
Supported formats: Attribute document-format-supported: SimpleIppValue-Type:MimeMediaType-Value:application/oxps