练习 - 将 SharePoint 框架解决方案部署到网站集应用程序目录
在本练习中,你将了解如何启用网站集范围的应用目录并向其部署应用。
Microsoft正在从经典应用程序目录转换为新式应用程序目录。 但是,这仅适用于租户应用程序目录。 网站集应用程序目录仍使用经典用户体验。
启用网站集应用程序目录
导航到现有网站集,然后从左侧导航栏中选择“网站内容”。
在“网站内容”页面的列表集中,查找名为“SharePoint 相关应用”的库。 如其存在,则可以跳到本练习的下一步。 否则将需要创建网站集应用程序目录。
根据开发平台,创建新的网站集应用程序目录:
如果使用的是 Windows,则可以使用 SharePoint Online 命令行管理程序PowerShell 模块:
# login as a tenant admin to the SharePoint Online tenant admin site
# replace the URL shown below with the URL of your SharePoint Online tenant admin site
PS> Connect-SPOService -Url https://contoso-admin.sharepoint.com
# create site collection App Catalog
# replace the URL shown below with the URL of a site collection within your SharePoint Online tenant
PS> Add-SPOSiteCollectionAppCatalog -Site https://contoso.sharepoint.com/sites/dev01
还可以将 CLI 用于Microsoft 365。 当开发环境不是 Windows 时,这将是不错的选择。
# login as a tenant admin to the SharePoint Online tenant
m365 login
# create site collection App Catalog
# replace the URL shown below with the URL of a site collection within your SharePoint Online tenant
m365 spo site appcatalog add --url https://contoso.sharepoint/sites/dev01
在执行创建新网站集应用程序目录的命令几分钟后,应该会在“网站内容”页中看到“SharePoint 相关应用”库。
将包部署到网站集应用程序目录
找到在上一练习中创建的 *.sppkg 。
在浏览器中,导航到包含上一步骤中的网站集应用程序目录的网站集。
在左侧导航中选择“网站内容”。
在网站内容列表中选择“SharePoint 相关应用”库。
将前面步骤中创建 的 *.sppkg 拖动到 “SharePoint 应用程序” 库中。
SharePoint 将启动一个对话框,询问是否要信任该包:
选择“部署”。
验证应用程序仅在当前网站集中可用
在左侧导航中选择“网站内容”。
在新建菜单中,选择应用。
找到之前部署的解决方案。 需要为下一个练习安装应用,请选择它来启动该进程。
现在,请导航到其他网站集。
在左侧导航中选择“网站内容”。
在新建菜单中,选择应用。
请注意,没有显示部署到其他网站集的解决方案。
摘要
在本练习中,你已了解如何启用网站集范围的应用目录并向其部署应用。