当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 使用 PowerShell 在 SharePoint Online 通信网站中设置页脚

作者:精品下载站 日期:2024-12-14 15:32:49 浏览:15 分类:玩电脑

使用 PowerShell 在 SharePoint Online 通信网站中设置页脚


要求:使用 PnP PowerShell 在 SharePoint Online 通信网站中设置页脚。

如何使用 PnP 配置模板在 SharePoint Online 中配置页脚链接?

转到 GitHub 上的 PnP 配置架构存储库并构建您的配置模板。 https://github.com/SharePoint/PnP-Provisioning-Schema,这是我的:

为页脚链接配置模板 XML:


<?xml version ="1.0"?>
<pnp:Provisioning xmlns:pnp="https://schemas.dev.office.com/PnP/2019/03/ProvisioningSchema">
 <pnp:Preferences/>
 <pnp:Templates ID="CONTAINER-TEMPLATE-c49f81cd-19d0-458d-a99d-1a616c252add">
  <pnp:ProvisioningTemplate ID="TEMPLATE-c49f81cd-19d0-458d-a99d-1a616c252add" Version ="1">
  <pnp:Footer Enabled="true" Name="" Logo="SiteAssets/logo.png" RemoveExistingNodes="true">
    <pnp:FooterLinks>
      <pnp:FooterLink DisplayName="Contact Us" Url="https://www.crescent.com/contact-us" />
      <pnp:FooterLink DisplayName="Site Map" Url="https://www.crescent.com/sitemap" />
      <pnp:FooterLink DisplayName="Privacy Policy" Url="https://www.crescent.com/privacy-policy" />
     </pnp:FooterLinks>
  </pnp:Footer>
  </pnp:ProvisioningTemplate>
  </pnp:Templates>
</pnp:Provisioning>

进行必要的更改并将其另存为 XML 文件。例如,PnpFooter.xml

PowerShell 应用配置模板

模板准备就绪后,使用以下 PnP PowerShell 脚本将模板应用到站点。


#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/hr"
$TemplateXML  ="C:\Users\salaudeen\Desktop\PnpFooter.xml"
 
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Apply provisioning Template
Invoke-PnPSiteTemplate -path $TemplateXML

这是正在运行的脚本

[玩转系统] 使用 PowerShell 在 SharePoint Online 通信网站中设置页脚

如果页脚尚未启用,您可能需要启用它:如何在 SharePoint Online 通信网站中启用或禁用页脚?

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯