Excel Automation Scenarios with SharePoint Client-Side Development

Excel Automation Scenarios with SharePoint Client-Side Development
Slide Note
Embed
Share

In this comprehensive guide, Julie Turner, a seasoned professional developer, delves into Excel automation scenarios using SharePoint client-side development. Explore topics such as the Graph API, accessing tokens, Excel extensions, data manipulation, formatting, table creation, and more. Gain insights into working with Microsoft technologies and enhancing your SharePoint development skills.

  • Excel Automation
  • SharePoint Development
  • Client-Side
  • Microsoft Technologies
  • Graph API

Uploaded on Feb 28, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Excel automation scenarios with SharePoint client-side development Julie Turner

  2. Are you in the right spot? Developer who s done client side dev in SharePoint and is very familiar with JavaScript/TypeScript. Or Interested in the technology and are looking for an understanding of what s possible and how much effort it might take.

  3. Julie Turner Principal Architect Professional developer since 1995 Working with SharePoint since 2007 Microsoft MVP, Office Servers and Services http://julieturner.net https://www.linkedin.com/in/juliemturner @jfj1997 http://bit.ly/julieturnerslides https://github.com/juliemturner/Public-Samples

  4. Agenda What is the Graph How to get an Access Token What is the Excel Extension Getting the file/workbook/worksheet Adding data, formatting Creating tables, adding columns & rows Creating custom data table and chart Persistence

  5. Microsoft Graph API

  6. Azure Application Authentication Azure Active Directory (Azure AD) v2.0 endpoint to authenticate users with: personal Microsoft accounts (live.com/outlook.com) enterprise (that is, work or school) accounts https://apps.dev.microsoft.com Azure Active Directory v1.0 endpoint to authenticate users with: enterprise (that is, work or school) accounts ONLY https://portal.azure.com

  7. MSAL Microsoft Authentication Library production-supported preview Unified library for Microsoft Accounts, Azure AD accounts and Azure AD B2C users indifferently .NET 4.5 and above (desktop app and web apps) Windows universal apps Windows Store apps (Windows 8 and above) iOS & Android (via Xamarin) .Net Core native iOS native Android MSAL JavaScript

  8. ADAL AD Authentication Library Library for Azure AD accounts .NET Client, Windows Store, UWP, Xamarin iOS and Android (ADAL .NET v3) .NET Client, Windows Store, Windows Phone 8.1 (ADAL .NET v2) JavaScript iOS, macOS Android Node.js Java

  9. Flowing Implicit Grant Flow 1. App uses Azure AD s authorization endpoint to authenticate. Azure AD issues an access token in response Use the tenant s authentication endpoint to authenticate user and request a token. Azure AD issues an access token. 2. Authorization Code Grant Flow Client Credentials Grant Flow App uses Azure AD s authorization endpoint to authenticate. Create a SSL certificate and register it with our Azure AD app (public cert) 1. 1. Azure AD redirects you on successful logins back to a specific URL in the app with authorization code authorization code 2. Use a private cert to encrypt a string to send to the access token endpoint (as application) 2. App uses authorization code to obtain access tokens on your behalf (impersonating user) 3. Looking at the Different OAuth2 Flows Supported in AzureAD for Office 365 APIs - Andrew Connell

  10. ADAL Base level library Create Get Access Token Cached User Available? Yes Authentication Context Provides Domain specific logic for crafting and parsing OAuth2 messages Maintains state by caching tokens Maintain token freshness, requesting extra tokens when needed N o Login User Redirects the browser session to the token request URL Handle Callback

  11. What is the Excel Extension SharePoint Site Collection SharePoint List (Library) Document (Drive Item) Excel Extension

  12. Getting the File Get the File - Base https://graph.microsoft.com/v1.0/sites/ sympraxis.sharepoint.com, 3999d07d-9cee-4574-be34-04c184dedbf2, ca999805-d4d1-49ea-a625-1c275cb0bc4d/ lists/4adb201b-0862-4e34-a3b7-642c72864a78/ items Response {@odata.context, value: [{ ,id,webUrl, ] }

  13. Getting the Workbook/Worksheet(s) Workbook base Base + /{id}/driveItem/workbook Get the Workbook/Worksheets Worksheets Base Base + /{id}/driveItem/workbook/worksheets Response {@odata.context: , value: [{@odata.id: , id: , name: , position: , visibility: }] }

  14. Demo Getting the file/workbook/worksheet(s)

  15. Adding/Renaming a Worksheet Add a new Worksheet Worksheets Base + /add POST payload {"name": newName} Response 200 OK Rename Worksheet Worksheets Base + /{sheetName} PATCH payload {"name": newName} Response 200 OK

  16. Adding a Worksheet Data Add data Worksheet Base + ({worksheetName})/range(address= {range} ) PATCH - payload {values: [["Id", "Title", "Status", "Business Unit", "Category", "Due Date", "Assigned To"]]} RESPONSE 200 OK {"address": "address-value", "addressLocal": "addressLocal-value", "cellCount": 99, "columnCount": 99, "columnIndex": 99, "valueTypes": "valueTypes-value"}

  17. Formatting data Format data Worksheet Base + ({worksheetName})/range(address= {range} ) PATCH payload {numberFormat: [null, null, null, null, null, format, null]} RESPONSE 200 OK {"address": "address-value", "addressLocal": "addressLocal-value", "cellCount": 99, "columnCount": 99, "columnIndex": 99, "valueTypes": "valueTypes-value"}

  18. Demo Adding sheets/data and formatting it

  19. Creating tables Creating a table Workbook base + /tables/add POST payload {address: worksheetId + "!" + range, hasHeaders: true} RESPONSE 200 OK {id: "99", name: "name-value", showHeaders": true, showTotals": true, style: "style-value"}

  20. Adding columns Adding a new calculated column Worksheet Base + ({worksheetName})/range(address= {range} ) PATCH payload {values: [["Weekday"]], formulas: [[null]]} RESPONSE 200 OK {"address": "address-value", "addressLocal": "addressLocal-value", "cellCount": 99, "columnCount": 99, "columnIndex": 99, "valueTypes": "valueTypes-value"}

  21. Adding Rows Adding a new row of data Workbook base + /tables/" + tableId + "/rows/add POST payload {index: 0, values: [[newRow.id, newRow.title, newRow.status, newRow.businessUnit, newRow.category, newDateString, newRow.assignedTo, null]]} RESPONSE 200 OK {index: 99, values: "values-value"}

  22. Demo Creating tables, adding columns & rows

  23. Creating Custom Data Table Creating a custom data table Manipulate the data PATCH new data to worksheet Worksheet Base + ({worksheetName})/range(address= {range} ) POST add table to cell range Workbook base + /tables/add

  24. Creating a Chart Add a chart based on the custom data Worksheets Base + ('" + worksheetId + "')/charts/add POST payload {type: chartType, sourceData: range, seriesBy: "Auto"} RESPONSE 200 OK {id: "id-value", height: 99, left: 99}

  25. Demo Creating custom data table and chart

  26. Persistence By default, sessions are persistent (7 min/5 min) Creating/Closing/Refresh a workbook session Workbook base + /createSession Workbook base + /closeSession 204 No Content Workbook base + /refreshSession 204 No Content POST payload {persistChanges: false} RESPONSE 201 Created {id: "id-value", persistSession: false} Include id in header of subsequent calls (including refresh/close) workbook-session-id: {session-id}

  27. Demo Persistence

  28. Thank You Resources OAuth Flows Andrew Connell Looking at the Different OAuth2 Flows Supported in AzureAD for Office 365 APIs ADAL GitHub Azure Active Directory Library for JS Cloud Identity Introducing ADAL JS v1 Microsoft Graph API Microsoft App authentication with Microsoft Graph Microsoft - Graph API Excel Reference Microsoft Graph JavaScript Client Library MORE The Slides: http://bit.ly/julieturnerslides The Blog Article(s): http://julieturner.net The GitHub Repo: https://github.com/juliemturner/Public-Samples

More Related Content