List View Invoke Tech Details¶
This solution was built using SharePoint Framework (SPFx), Azure Functions, and Azure Service Bus choices discussed below. We used TypeScript to build all of the pieces of our solution, however the function piece could just as easily been written in any language available to run on Azure Functions. SPFx, as a client-side technology, requires the use of TypeScript or JavaScript.
Additionally, there is a list of reference links we found useful while building our solution.
SharePoint Framework¶
SharePoint Framework (SPFx) is the way to add UI features including client-side code in SharePoint Online. We used a List View Command Set extension to include our button directly into the UI for Libraries. This allows us to know to where we will write the generated document, along with who initiated the request. This is done using the built in capabilities of SPFx to call AAD secured APIs.
Azure Functions¶
Azure Functions are a cost effective, secure way to deploy solutions to Azure. While not appropriate for all applications the capabilities of functions met our needs. This solution could work similiarly using a full web app, VM, or other hosting while the flow remains the same. The key advantage of Azure Functions for us was the simple setup of authentication to ensure our solution is secure.
We used two functions, one to receive and queue the request and a second to do the work, to illustrate one way to help handle scale by ensuring a quick response back to the user, while providing time to complete the operations.
Azure Service Bus¶
The Service Bus allows us to create a buffer between requests (fast, many) and document generation (slower). This is a lightweight way to scale an application and met our needs - we also considered Azure SQL, but simple messaging worked in this case.
One consideration is that we are storing the user's bearer token within the queue message. OK for a sample, but the handling of tokens in production should adhear to the best available guidance.
Reference Links¶
We found the following list of links helpful while developing our solution:
SPFx app¶
- Build your first ListView Command Set extension
- Connect to Azure AD-secured APIs in SharePoint Framework solutions
Azure Functions¶
- Overview
- Tools
- Http Triggered Functions
- Create a function app for serverless code execution
- Securing Azure Functions
- Token Store
- Configure how end-users consent to applications
- Configure your App Service or Azure Functions app to use Azure AD login
- Azure Functions JavaScript developer guide
- Call API securely from browser code
- Microsoft identity platform and OAuth 2.0 On-Behalf-Of flow