如何防止Sharepoint Office 365在线将最常查看的链接添加到导航栏?

时间:2016-04-14 11:02:56

标签: sharepoint-online

Sharepoint Office 365会自动添加指向大多数查看过的网页的链接。如何防止它。很难隐藏“网站设置”中每个新出现的链接>导航设置。谢谢!

1 个答案:

答案 0 :(得分:0)

您可以通过 SharePoint CSOM API 从左侧导航中删除Recent节点。

  

先决条件:SharePoint Online Client Components SDK

以下示例演示了如何从PowerShell中的左导航中删除Recent节点:

Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" 
Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" 


Function Get-Context([string]$Url,[string]$Username,[string]$Password){
   $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
   $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
   $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url)
   $ctx.Credentials = $credentials
   return $ctx
}


Function Delete-NavigationNode([Microsoft.SharePoint.Client.Web]$Web,[string]$NodeTitle){
   $ctx = $Web.Context
   $nodes = $Web.Navigation.QuickLaunch
   $ctx.Load($nodes)
   $ctx.ExecuteQuery()

   $node = $nodes.GetEnumerator() | where { $_.Title -eq $NodeTitle } | Select -First 1 
   $node.DeleteObject()
   $ctx.ExecuteQuery()
}



$Url = "https://contoso.sharepoint.com/"
$Username = "jdoe@contoso.onmicrosoft.com"
$Password = ""


$ctx = Get-Context -Url $Url -Username $Username -Password $Password
Delete-NavigationNode -Web $ctx.Web -NodeTitle "Recent"