[英]Add alternative language to SharePoint Online Sites PowerShell
I am trying to Add Alternative Language to my SharePoint sites using PowerShell: 我正在尝试使用PowerShell将替代语言添加到我的SharePoint网站:
$sitetenant = "https://mytenat-admin.sharepoint.com"
$credential = Get-Credential
Connect-SPOService -Url $sitetenant -Credential $credential
$sites = Get-SPOSite "https://mytenat.sharepoint.com/site"
foreach($site in $sites)
{
$culture = New-Object System.Globalization.CultureInfo(1033)
$site.AddSupportedUICulture($culture)
$site.Update()
}
I think this method doesn't exist in SharePoint Online? 我认为SharePoint Online中不存在这种方法吗?
SharePoint Online Management Shell cmdlets are pretty limited in this regard, i would suggest to utilize CSOM API, in particular Web.AddSupportedUILanguage
method to add alternative language as demonstrated below: SharePoint Online命令行管理程序 cmdlet在这方面非常有限,我建议使用CSOM API,尤其是
Web.AddSupportedUILanguage
方法来添加替代语言,如下所示:
$siteUrl = "https://contoso.sharepoint.com/"
$UserName = "username@contoso.onmicrosoft.com"
$Password = ""
$SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$ctx.Credentials = $credentials
$web = $ctx.Site.RootWeb
$lcid = 1049
$web.AddSupportedUILanguage($lcid)
$web.Update()
$ctx.ExecuteQuery()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.