2

Powershell と CSOM を使用して、SharePoint Online サイトにサイト ロゴを設定できた人はいますか? ありがとう

ナイジェル

4

4 に答える 4

1

これは、sharepoint 2016でpowershellを使用してデフォルトのsharepointロゴを変更するスクリプトです

$logoLocation= "http://sharepoint2016/SiteAssets/MyCompanyLogo.png"
$oSite=new-object Microsoft.SharePoint.SPSite("http://sharepoint2016/")
foreach($oWeb in $oSite.Allwebs) {
$oWeb.SiteLogoUrl=$logoLocation
$oWeb.Update()
}
于 2016-10-19T19:47:14.533 に答える
1

UserVoice の要求に従って SiteLogoUrl プロパティを CSOM で使用できるようにし、SharePoint API の改善を促進する UserVoiceを投稿すると、新しいバージョンのSharePoint Online クライアント コンポーネント SDK WebクラスがSiteLogoUrlプロパティをサポートします。

Web.SiteLogoUrl propertyPowerShell で CSOM を使用して設定する方法:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

Function Get-SPOCredentials([string]$UserName,[string]$Password)
{
   $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
   return New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
}

Function Web-SetLogo([Microsoft.SharePoint.Client.ClientContext]$Content,[string]$SiteLogoUrl)
{
   $Context.Web.SiteLogoUrl = $SiteLogoUrl
   $Context.Web.Update()
   $Context.ExecuteQuery()
}

$UserName = "username@contoso.onmicrosoft.com"
$Password = Read-Host -Prompt "Enter the password"    
$Url = "https://contoso.sharepoint.com/"

$context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$context.Credentials = Get-SPOCredentials -UserName $UserName -Password $Password

Web-SetLogo -Content $context -SiteLogoUrl "/SiteAssets/ContosoLogo.jpg"

$context.Dispose()
于 2014-12-01T21:28:37.697 に答える