question

GopiRadhika-0333 avatar image
0 Votes"
GopiRadhika-0333 asked GopiRadhika-0333 edited

Graph API - Sharepoint - POSTMAN - Could not obtain a WAC access token

when trying to access Sharepoint workbook receiving the error "403 forbidden Could not obtain a WAC access token". However able to get the items in the sharepoint site.

Azure AD permissions:
"roles": [
"Sites.Read.All",
"User.Read.All",
"Files.Read.All"
],

office-sharepoint-onlinemicrosoft-graph-sdk
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@GopiRadhika-0333, Could you share the endpoint you use?

0 Votes 0 ·
MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered GopiRadhika-0333 edited

Hi @GopiRadhika-0333

I could replicate the issue if the exvel file is .xls extension. So I think your excel file is .xls file.

However, the Excel REST API supports only Office Open XML file formatted workbooks. The .xls extension workbooks are not supported.

Please refer to this article for more: https://docs.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Hi @MichaelHan-MSFT
No I created the workbook via sharepoint online (Office 365). They are with extension .xlsx. Please see attached. There are some .csv files in this sharepoint site under other folders but nothing under the folder that I am trying to extract the workbook.


!

85798-image.png



0 Votes 0 ·
image.png (12.7 KiB)

Hi @GopiRadhika-0333

I created the workbook via sharepoint online as you said. And I could accees the workbook successfully.

Which item Id did you use? Please make sure you are using the excel file Id instead of folder Id.


86060-image.png


1 Vote 1 ·
image.png (26.6 KiB)

Thanks @MichaelHan-MSFT you helped me to resolve this issue.

0 Votes 0 ·
MichaelHan-MSFT avatar image
1 Vote"
MichaelHan-MSFT answered GopiRadhika-0333 edited

Hi @GopiRadhika-0333

Per my test, I could aceess the workbook in SharePoint successfully.


85034-image.png



If an Answer is helpful, please click "Accept Answer" and upvote it.
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.



image.png (72.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MichaelHan-MSFT ,
I have set the following permissions in Azure AD.


85417-microsoftteams-image.jpeg



But getting "Could not obtain a WAC access token" in POSTMAN and 403 forbidden in Graph explorer UI.

URL Endpoint:https://graph.microsoft.com/v1.0/sites/<site>.sharepoint.com,<id>/lists/<itemid>/items/1/driveitem/workbook/worksheets

Error in Graph explorer:
85357-screenshot-2021-04-07-111220.png


0 Votes 0 ·
GopiRadhika-0333 avatar image
0 Votes"
GopiRadhika-0333 answered

I have set the following permissions in Azure AD.


85417-microsoftteams-image.jpeg



But getting "Could not obtain a WAC access token" in POSTMAN and 403 forbidden in Graph explorer UI.

URL Endpoint:https://graph.microsoft.com/v1.0/sites/<site>.sharepoint.com,<id>/lists/<itemid>/items/1/driveitem/workbook/worksheets

Error in Graph explorer:
85357-screenshot-2021-04-07-111220.png



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.