SharePoint 加载项的租赁和部署范围Tenancies and deployment scopes for SharePoint Add-ins

SharePoint 租赁是 SharePoint 场或 SharePoint Online 中的一组网站集。A SharePoint tenancy is a set of site collections in either a SharePoint farm or in SharePoint Online. 在 SharePoint Online 中,网站集属于各个客户帐户。In SharePoint Online, the site collections belong to a single customer account. 在 SharePoint 场中,网站集可以是 SharePoint Web 应用中的所有或部分网站集,也可以是场中跨多个 Web 应用的一组网站集。In a SharePoint farm, the site collections can be all the site collections in a SharePoint web application or a subset of them, or it can be a set of site collections from across multiple web applications in the farm. 租赁也可以有 SharePoint 加载项目录,就像 SharePoint Web 应用一样。A tenancy can have a SharePoint add-in catalog just as a SharePoint web application can.

租赁和加载项范围Tenancies and add-in scope

SharePoint 加载项有加载项范围A SharePoint Add-in has an add-in scope. 加载项范围分为以下两种:Web 范围或租户范围。The two possible add-in scopes are web scope or tenant scope. 这两种范围的区别并不是加载项的固有属性,而开发人员也不决定加载项范围。The difference is not an intrinsic property of the add-in, and you, the developer, do not decide what the scope of your add-in is. 决定加载项范围的是租户管理员,这是由于加载项安装方式间接所致。The decision is made by tenant administrators as a side effect of how the add-in is installed.

将加载项上传到租赁的加载项目录后,加载项便立即可供安装到租赁内的各个网站上。After an add-in is uploaded to the add-in catalog of a tenancy, it is immediately available to be installed on websites within the tenancy on a website-by-website basis. 采用这种方法安装的加载项具有 Web 范围Add-ins that are installed this way have web scope.

不过,租户管理员还可以采用另一种方法。Tenant administrators have another option, however. 他们可以选择将加载项批量安装到租赁内的一部分网站。They can choose to batch install the add-in to a subset of websites within the tenancy. 采用这种方法安装的加载项具有租户范围Add-ins that are installed in this way have tenant scope. 租户管理员可以使用管理路径列表、网站模板列表或网站集列表,指定将加载项安装到的网站。The tenant admin can specify which websites the add-in is installed to by means of a list of managed paths, a list of site templates, or a list of site collections. 批量安装的加载项只能由租户管理员卸载。An add-in that has been batch-installed can only be uninstalled by a tenant administrator. 如果租户管理员卸载加载项,它也会从租赁中的各个网站卸载。When the tenant admin uninstalls the add-in, it is uninstalled from every website in the tenancy. 用户无法从各个网站卸载批量安装的加载项。Users can't uninstall a batch-installed add-in on a website-by-website basis. 这一原则同样也适用于更新批量安装的加载项:只能由租户管理员进行更新,并且在租赁中已安装加载项的每个网站上,加载项会进行批量更新。The same principle applies to updating a batch-installed add-in: only a tenant administrator can do it, and it is batch-updated on every website in the tenancy where it is installed.

如果批量安装包含加载项 Web 的加载项,只会创建一个加载项 Web,安装加载项的所有主机网站都会共用它。If an add-in that includes an add-in web is batch-installed, only one add-in web is created, and it is shared by all the host websites on which the add-in is installed. 此加载项 Web 位于组织加载项目录的网站集中。The add-in web is located in the site collection of the organization's add-in catalog.

如果租赁中新建网站集,之前批量安装的加载项会自动安装到新网站集中。When new site collections are created in the tenancy, add-ins that were previously batch-installed are automatically installed on the new site collection.

备注

不得混淆加载项范围和功能范围。Add-in scope should not be confused with Feature scope. 功能范围决定了功能元素的部署位置。Feature scope determines where the elements in a Feature are deployed. 可能的位置包括Web 应用网站(即网站集)和 WebThe possibilities include Farm, WebApplication, Site (that is, site collection), and Web. 对于 SharePoint 加载项中的功能(主机 Web 功能和加载项包中 .wsp 内的功能),只能使用 WebOnly Web is permitted for Features in SharePoint Add-ins (both host web features and features inside a .wsp in an add-in package).

也不得混淆加载项范围和加载项权限级别。Add-in scope should also not be confused with add-in permission levels. SharePoint 加载项可以在列表、Web、网站集和租赁一级,请求获取对所有或部分选定 SharePoint 内容的权限。SharePoint Add-ins can request permissions to all or selected parts of SharePoint content at the levels of list, web, site collection, and tenancy. 如果使用租户范围安装加载项,既不会向加载项授予本来没有的权限,也不会取消 SharePoint 安全模型的关键预配。Installing an add-in with tenant scope does not give it permissions that it would not otherwise have, nor does it cancel key provisions of the SharePoint security model. 若要详细了解加载项权限,请参阅 SharePoint 中的加载项权限For more information about add-in permissions, see Add-in permissions in SharePoint.

租户范围加载项的限制Limitations of tenant-scoped add-ins

以下类型的加载项在批量安装后无法正常运行:The following types of add-ins will not work correctly when batch-installed:

  • 包含功能区自定义操作的加载项(允许包含部署为菜单项的自定义操作)。Add-ins that contain a custom action for the ribbon (custom actions that are deployed as menu items are allowed)
  • 包含加载项部件的加载项Add-ins that contain an add-in part

另请注意,在 SharePoint Online 的 Office 365 小型企业高级版中,无法使用租户范围进行安装。In addition, note again that installation with tenant scope is not possible in the Office 365 Small Business Premium version of SharePoint Online.

如何在租赁中的多个网站上安装、卸载和更新加载项How to install, uninstall, and update an add-in on multiple websites in a tenancy

无论是从 Office 商店还是从外接程序目录安装外接程序,租户管理员都可以通过以下步骤在租赁中的多个网站中安装、卸载和更新外接程序。Regardless of whether an add-in is installed from the Office Store or from an add-in catalog, tenant admins can install it to multiple websites in a tenancy, uninstall it, and update it by using the following procedures.

将 SharePoint 加载项安装到多个网站的具体步骤To install a SharePoint Add-in to multiple websites

  1. 转到企业目录网站的“网站内容”**** 页。Go to the Site Contents page of the corporate catalog website.

  2. 选择“添加加载项”****,并安装加载项,就像在其他任何 SharePoint 网站上安装一样。Select Add an add-in, and install the add-in just as you would on any other SharePoint website.

  3. 安装加载项后,将鼠标悬停在“网站内容”**** 页中的加载项链接之上。After the add-in is installed, hover over the link to the add-in on the Site Contents page. 此时,“...”**** 链接显示。A "..." link appears.

  4. 选择此链接后便会看到标注。Select the link, and a callout appears.

  5. 在菜单上选择"部署"。Select Deployment on the menu.

  6. 使用打开的部署 UI 指定要将外接程序安装到的网站集。您可以按管理路径、网站模板或 URL 进行筛选。筛选器拥有逻辑"OR"关系:外接程序被安装到通过任意一个或多个筛选器的网站集的并集中。Use the deployment UI that opens to specify the site collections to which you want the add-in installed. You can filter by managed paths, site templates, or URLs. The filters have a logical "OR" relationship: the add-in is installed to the union of all the site collections that pass any one or more of the filters.

  7. 选择"确定"。Select OK.

卸载批量安装的 SharePoint 加载项的具体步骤To uninstall a batch-installed SharePoint Add-in

  1. 转到企业目录网站的“网站内容”**** 页。Go to the Site Contents page of the corporate catalog website.

  2. 将鼠标悬停在“网站内容”**** 页中的加载项链接之上。Hover over the link to the add-in on the Site Contents page. 此时,“...”**** 链接显示。A "..." link appears.

  3. 选择此链接后便会看到标注。Select the link, and a callout appears.

  4. 选择标注上的"删除"。Select Remove on the callout.

更新批量安装的 SharePoint 加载项的具体步骤To update a batch-installed SharePoint Add-in

  1. 转到企业目录网站的“网站内容”**** 页。Go to the Site Contents page of the corporate catalog website. 若有可用加载项更新,加载项旁边会显示消息。If there is an update available for an add-in, a message appears next to the add-in. 将会看到加载项更新链接。There will be a link to update the add-in.

  2. 选择此链接即可更新加载项。Select the link to update the add-in.

  3. 如果系统提示批准加载项的权限请求,请选择“信任它”****。When you are prompted to approve the permission requests of the add-in, select Trust It.

另请参阅See also