![](/img/trans.png)
[英]Need to Add Translators for Language in SharePoint Online using PnP PowerShell
[英]Add alternative language to SharePoint Online Sites 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()
}
我认为SharePoint Online中不存在这种方法吗?
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.