本文介绍了向 SharePoint Online 站点 PowerShell 添加替代语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 PowerShell 向我的 SharePoint 网站添加替代语言:
I am trying to Add Alternative Language to my SharePoint sites using PowerShell:
$sitetenant = "mytenat-admin.sharepoint" $credential = Get-Credential Connect-SPOService -Url $sitetenant -Credential $credential $sites = Get-SPOSite "mytenat.sharepoint/site" foreach($site in $sites) { $culture = New-Object System.Globalization.CultureInfo(1033) $site.AddSupportedUICulture($culture) $site.Update() }我认为 SharePoint Online 中不存在此方法?
I think this method doesn't exist in SharePoint Online?
推荐答案SharePoint Online Management Shell cmdlet 在这方面非常有限,我建议使用 CSOM API,特别是 Web.AddSupportedUILanguage 方法添加替代语言,如下所示:
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:
$siteUrl = "contoso.sharepoint/" $UserName = "username@contoso.onmicrosoft" $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()更多推荐
向 SharePoint Online 站点 PowerShell 添加替代语言
发布评论