- In Microsoft Teams, I have crated an App that lists files of a certain type in a Tab
- The use case is that the contents of the file need to be read by my Javascript
- the Javascript in the Tab already successfully gets an ID Token and Access Token (via ADAL)
- this code already successfully lists the DriveItems in the group the current logged in user can see
via
https://graph.microsoft.com/v1.0/groups/${groupId}/drive/root/search(q='{pdf}')
;` when I attempt to GET the DriveItem via
https://graph.microsoft.com/v1.0/groups/${groupId}/drive/items/${itemId}/content
where the
itemId
is returned from the first callI successfully see the HTTP 302 from the
https://graph.microsoft.com
endpoint redirecting tohttps://<thesharepointsite>.sharepoint.com/<etc>
Axios (and the Microsoft Graph Javascript API) are successfully traversing to the redirect
Postman, with the same
https://graph...
URL with the AccessToken successfully downloads the binary content from the 302 redirect (so it is not an Auth issue)
PROBLEM
- in Microsoft Teams, inside my Tab, the browser (built inside of the Teams desktop app) HTTP calls to
https://<thesharepointside>.sharepoint.com
respond with a 405 error on the OPTIONS call - usually this means there is a CORS issue, and so the solution is to add the domain to the
validDomains
of the app
Attempted Solution
- the Manifest has the following entries in validDomains
"validDomains": [
...
"*.sharepoint.com",
"graph.microsoft.com",
"login.microsoftonline.com"
]
- manually add the full domain the the Teams App's Manifest
- use the suggested "{teamsitedomain}" as per https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#validdomains
- *.sharepoint.com as per above
- use the Microsoft Graph Javascript APIs
In all instances, I get 405 on the OPTIONS call
No file download from within the Tab within Microsoft Teams.
Suggestions?