4 Add-ins to MS Word
Add-ins are plugins that integrate with Microsoft Word. Add-ins provided by Wrepit are intended for desktop use on Windows and Mac computers.
4.1 What are add-ins?
Add-ins for MS Word are downloadable from Microsoft App Source. They are web applications that operate inside a sandboxed browser environment directly within the MS Word application, and has access to a Javascript API to read and modify the Word document. (Microsoft Documentation for Developing Add-ins)
4.2 What is MS Graph?
Microsoft Graph is your organization’s internal Microsoft API, and can be used to e.g. obtain user information and interact with your Sharepoint. MS Graph is built with a permission system, where you can grant external parties permissions to certain parts of your MS Graph API. For instance, to read your user data from MS Graph, the permission User.Read must be given.
4.3 Which add-ins does Wrepit provide?
Wrepit currently provides Wrepit Highlights and Excel2Word by Wrepit.
Both add-ins require installation (See Required installation).
4.4 Add-in security
Wrepit add-ins operate within the sandboxed browser environment inside Microsoft Word. Thus they have access to read and modify the data in the Word document.
To be transparent, Wrepit has built the add-ins as Single-Page Applications (SPA), running inside the sandboxed browser. The reason for designing the add-ins this way is to maintain data transparency: Wrepit could never collect data to any servers without leaving traces in the browser network tab. This supports our pledge that no data should ever leave the Microsoft Word environment.
4.5 Add-in hosting
Add-ins store necessary metadata inside your Word document using Content Controls or the Settings API. No add-in data is sent to Wrepit servers or to any third parties.
4.6 MS Graph permissions
During the approval of Excel2Word by Wrepit you will be presented with a set of Microsoft Graph permissions you must approve. This article explains which permissions the add-in requires and how they are used.
4.6.1 Delegated permissions
Microsoft Graph has 2 different sets of permissions: application permissions and delegated permissions. Application permissions allows the application to act as any user, whereas delegated permissions allows only signed-in users of the application.
All permissions requested by Excel2Word by Wrepit are delegated permissions. The add-in is run in a sandboxed browser environment on the user’s computer. Thus the permissions for the user of the add-in are limited by both the MS Graph permissions and the MS 365 user’s permissions.
By using delegated permissions, users of the add-in will never have access to anything they wouldn’t otherwise have access to in your organization’s Microsoft 365 tenant. Since Excel2Word by Wrepit only accesses Excel files in your organization, the user can only access Excel files that have been shared directly with the user.
Please refer to the Microsoft Graph permissions docs for more details on delegated permissions.
4.6.2 Requested permissions
Excel2Word by Wrepit requires the following permissions, following the least necessary access principle:
- Sign in and read user profile (User.Read)
- Used to sign in to the add-in and read the user profile
- Either Files.Read.All or Sites.Selected
- Used to read Sharepoint Share links to Excel files, and to retrieve the contents of the Excel file.
- Read all files that user can access (Files.Read.All)
- Access selected Sites, on behalf of the signed-in user (Sites.Selected)
- With this option the IT Administrator must explicitly grant access for the add-in to specific Sharepoint sites. In practice this means you can limit the add-in’s access to e.g. a specific Teams group or sub-site of your Sharepoint and thereby manage your organization’s risk exposire.
Please refer to the Microsoft Graph Permissions reference for full details on what permissions scopes grants access to what, as well as a full explainer from Microsoft on app permissions and admin consent.
4.6.3 How Excel2Word by Wrepit uses these permissions
After having received the MS Graph permissions, the add-in uses your MS Graph API to call the following API endpoints:
- Users → User → Get (/me): To display basic user information in the add-in.
- Files → Permissions → Use Sharing Links combined with Files → Drive Items → Get Item: To get the Excel file from a Sharepoint Sharing Link and read its contents.
- Workbooks → Range → Get Range: To get data from named Excel ranges.
Since the add-in is built as a Single Page Application (SPA), every API interaction occurs client-side and can be inspected in the browser network tab inside MS Word.
4.6.4 Additional setup for the Sites.Selected permission
The Sites.Selected permission works as a combination between Delegated and Application permissions, and the following 2 requirements must be met for the user to be able to find Excel files inside the Sharepoint site:
- The user must have access to the files in that Sharepoint.
- The add-in must be granted explicit access to the Sharepoint.
To grant the add-in explicit access to a Sharepoint site, read on below.
- Prerequisites:
- You need Admin access to grant Sharepoint site permissions.
- You need a method to manage those permissions, e.g. by calling your organization’s MS Graph API. Calling the API can e.g. be done via The Official Microsoft Graph Explorer.
- Follow these steps:
- Identify the site you want, e.g: https://company.sharepoint.com/sites/MySite
- Find the Sharepoint {SiteID} for the site and note it down:
- GET call: https://graph.microsoft.com/v1.0/sites/root:/sites/MySite
- Note down the “id” attribute’s value.
- Grant the add-in Read permissions to the site:
- POST call, with the JSON body below: https://graph.microsoft.com/v1.0/sites/{SiteID}/permissions (replace {SiteID} with the “id” you noted above)
- Repeat the above steps for any other Sharepoint Site your users need to access via the add-in.
{
"roles": ["read"],
"grantedToIdentities": [
{"application": {
"id": "7756aaed-225f-416e-b79f-4635f99887c6",
"displayName": "Excel2Word by Wrepit can read this site"
}}
]}
- Microsoft’s reference for the above MS Graph calls can be found here:
- If you make any mistakes and want to edit or remove permissions, check the following reference:
4.6.5 Migration from Files.Read.All to Sites.Selected
To migrate from Files.Read.All to Sites.Selected, you need to follow these steps, preferably in order:
- (required step) Find a (or create a new) Sharepoint Site where you want all Excel2Word Excel files stored. This will be the Sharepoint Site which the add-in can read files from.
- You can e.g. create a new Teams team for this.
- (recommended step) Have your organization’s add-in users move existing Excel files to the selected sharepoint site. They can utilize the add-ins Replace File functionality to re-link files inside their Word documents. This can also be done at a later stage, but then your users will see error messages in the add-in, so make sure they are aware of the changes.
- (required step) Remove Files.Read.All permissions for the Excel2Word by Wrepit Enterprise Application.
- This can normally be done inside the Azure Portal, by finding the Enterprise Application named “Excel2Word by Wrepit”, under the “Permissions” menu item, in the “Admin Consent” tab, by hitting the “…” and “Revoke Permission”.
- Sometimes you may have delegated “User Consent” which is found under the “User Consent” tab. If that is the case, you can use the MS Graph API to delete Service Principal Permissions for the Enterprise Application.
- (required step) Add Sites.Selected permissions by following the steps in Additional setup for the Sites.Selected permission.
- (recommended step) Notify your organization’s add-in users that the change has happened. On their next sign-in to the add-in they must go to the “Sign-in Settings” on the front page, and enable the “Selected Sites Only” toggle. Otherwise they will not be allowed sign-in to the add-in anymore. This must be done once per device they are using for the add-in.