Jul 15, 2019

Connect to SharePoint Online from Postman

To connect to SharePoint Online with Microsoft Graph using OAuth 2.0 from Postman:
  1. Create an Azure AD App Registration with implicit grant flow and permissions for Microsoft Graph to Sites.Read.All
  2. In Postman, set the Get URL as https://graph.microsoft.com/v1.0/sites/mytenant.sharepoint.com:/subsitename:/lists/listname/items
  3.  In the Postman authorization section:
    1. Grant Type: Authorization code
    2. Callback URL: http://localhost
    3. Auth URL: https://login.microsoftonline.com/mytenant.onmicrosoft.com/oauth2/v2.0/authorize 
    4. Token URL: https://login.microsoftonline.com/mytenant.onmicrosoft.com/oauth2/v2.0/token 
    5. Client Id: The client id from your Azure AD App Registration
    6. Client secret: the client secret from your Azure AD App registration
    7. Scope: Sites.Read.All
    8. Save the changes and update the token.
  4. Send the GET request

Jan 10, 2019

3D and other thumbnails in SharePoint Online

Standard image and document thumbnails are easy to find in SharePoint Online but thumbnails for 3D files and other file formats are not so accessible as they are dynamically generated.

To get the thumbnail URL, we need to use the Graph API.
  1. Open the Microsoft Graph Explorer site to check your REST call syntax.
  2. Call https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/anothersitecollection:/drives to get the document libraries as drives and save the ID of the document library you need. Substitute your SharePoint tenant for "contoso" and your site collection URL component for "anothersitecollection".
  3.  Call https://graph.microsoft.com/v1.0/drives/b!aXYZmss8ZEiVokyC-JytN274MKTABCdAqaqixLW2-0JqtL9COCftQr9Ct9neeDKJ/root/children to get the documents in the document library.  Substitute your long drive ID for the example.
  4. Call https://graph.microsoft.com/v1.0/drives/b!aXYZmss8ZEiVokyC-JytN274MKTABCdAqaqixLW2-0JqtL9COCftQr9Ct9neeDKJ/items/01EQBDECC66F3P3O5YI5ABCIGG7O6M4Q23/thumbnails to get the thumbnail URLs.  Substitute your long document ID for the example.