This article describes the different permission levels that you declare in your add-in's manifest to specify the level of JavaScript API access your add-in requires for its features.
Önemli
This article applies to only non-Outlook add-ins. To learn about permission levels for Outlook add-ins, see Outlook permissions model.
Permissions model
A five-level JavaScript API access-permissions model provides the basis for privacy and security for users of your add-ins. The following figure shows the five levels of API permissions you can declare in your add-in's manifest.
These permissions specify the subset of the API that the add-in runtime allows your add-in to use when a user inserts, and then activates (trusts) your add-in. To declare the permission level your add-in requires, specify one of the permission values in the manifest. The markup varies depending on the type of manifest.
Unified manifest for Microsoft 365: Use the "authorization.permissions.resourceSpecific" property. The following example requests the write document permission, which allows only methods that can write to (but not read) the document.
The unified manifest for Microsoft 365 can be used in production Outlook add-ins. It's available only as a preview for Excel, PowerPoint, and Word add-ins.
Add-in only manifest: Use the Permissions element of the manifest. The following example requests the write document permission, which allows only methods that can write to (but not read) the document.
XML
<Permissions>WriteDocument</Permissions>
As a best practice, you should request permissions based on the principle of least privilege. That is, you should request permission to access only the minimum subset of the API that your add-in requires to function correctly. For example, if your add-in needs only to read data in a user's document for its features, you should request no more than the read document permission.
The methods of the Settings object, and the Document.getActiveViewAsync method. This is the minimum permission level that can be requested by an add-in.
read document
ReadDocument
Document.Read.User
All and only APIs that read the document or its properties.
In addition to the API allowed by the restricted permission, adds access to the API members necessary to read the document and manage bindings. This includes the use of:
The Document.getSelectedDataAsync method to get the selected text, HTML (Word only), or tabular data, but not the underlying Open Office XML (OOXML) code that contains all of the data in the document.
The Document.getFileAsync method to get all of the text in the document, but not the underlying OOXML binary copy of the document
The Document.goToByIdAsync method to navigate to named objects and locations in the document.
For task pane add-ins for Project, all of the "get" methods of the ProjectDocument object.
read all document
ReadAllDocument
Document.ReadAll.User
Same as read document.
In addition to the API allowed by the restricted and read document permissions, allows the following additional access to document data.
The Document.getSelectedDataAsync and Document.getFileAsync methods can access the underlying OOXML code of the document (which in addition to the text may include formatting, links, embedded graphics, comments, revisions, and so forth).
write document
WriteDocument
Document.Write.User
All and only APIs that write to the document or its properties.
In addition to the API allowed by the restricted permission, adds access to the following API members.
All Application-specfic APIs, including those that subscribe to events.
In addition to the API allowed by the restricted, read document, read all document, and write document permissions, includes access to all remaining API supported by add-ins, including methods for subscribing to events. You must declare the read/write document permission to access these additional API members:
All of the methods for subscribing to the events supported by add-ins, specifically the addHandlerAsync and removeHandlerAsync methods of the Binding, CustomXmlPart, Document, ProjectDocument, and Settings objects.
Bu içeriğin kaynağı GitHub'da bulunabilir; burada ayrıca sorunları ve çekme isteklerini oluşturup gözden geçirebilirsiniz. Daha fazla bilgi için katkıda bulunan kılavuzumuzu inceleyin.
Office Add-ins geri bildirimi
Office Add-ins, açık kaynak bir projedir. Geri bildirim sağlamak için bir bağlantı seçin: