问题
This question is very similar to a question which has been asked previously on StackOverflow. However, the error I'm getting is different.
AadHttpClient fails when loading SP page with SPFx webpart in MSTeams Desktop Client
I also have a Sharepoint Online site in which I have an SPfx web part which makes use of AadHttpClient. This webpart works if I navigate to the Sharepoint site from a browser or open MS Teams web client.
My setup is as follows:
- I have a team in MS Teams
- I added a new tab in Teams and selected Sharepoint from available apps
- I selected an existing Sharepoint site to be displayed
When I debugged the MS Teams desktop client, I have this call in in the Network requests tab:
{"odata.error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}
I wonder why this only happens in MS Teams desktop client and not on either the web client on Sharepoint Online.
来源:https://stackoverflow.com/questions/59860729/spfx-webpart-in-msteams-desktop-client-throws-an-unauthorizedaccessexception