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