【问题标题】:Add alternative language to SharePoint Online Sites PowerShell向 SharePoint Online 站点 PowerShell 添加替代语言
【发布时间】:2017-10-24 23:42:43
【问题描述】:

我正在尝试使用 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 中不存在此方法?

【问题讨论】:

  • 打开网站集的 RootWeb 并将所需语言的 LCID 传递给 AddSupportedUICulture 方法。例如。 $web = $site.OpenWeb(); $web.AddSupportedUICulture(1031)

标签: powershell sharepoint office365 sharepoint-online


【解决方案1】:

SharePoint Online Management Shell cmdlet 在这方面非常有限,我建议使用 CSOM API,特别是 Web.AddSupportedUILanguage method 添加替代语言,如下所示:

$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()

【讨论】:

    猜你喜欢
    • 2015-02-06
    • 2021-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-13
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    相关资源
    最近更新 更多