向 SharePoint Online 站点 PowerShell 添加替代语言

编程入门 行业动态 更新时间:2024-10-11 21:20:37
本文介绍了向 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 添加替代语言

本文发布于:2023-11-06 03:48:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562646.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语言   站点   SharePoint   Online   PowerShell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!