sharepoint - Powershell:使用SharePoint API,GetLocalizedString不返回任何内容

标签 sharepoint powershell

我有一个使用SharePoint api的函数,因此公开了方法SPUtility.GetLocalizedString。

我还确定了uint语言编号1033(英语)和1036(法语)作为参数之一。

[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

$en = 1033
$fr = 1036
$str = "$Resources:docliblist"
$resx = "core"
$locstr = [Microsoft.SharePoint.Utilities.SPUtility]::GetLocalizedString($str, $resx, $en)
$locstr
$locstr = [Microsoft.SharePoint.Utilities.SPUtility]::GetLocalizedString ("$Resources:doclibList", "core", $fr)
$locstr

当我运行该函数时,$ locstr为空。不为空,为空。

另外,当我以这种方式使用函数时:
$str = "$Resources:core, docliblist"
$locstr = [Microsoft.SharePoint.Utilities.SPUtility]::GetLocalizedString($str, $null, $en)

我得到一个返回值'docliblist'

现在,虽然我可以从resx文件中取出所需的内容并放入我自己的配置文件中,但对于为什么此方法不起作用我感到困惑。如果有人有任何建议,我将不胜感激。

谢谢。

*编辑

您更改引号的目的是什么?

最佳答案

如果$Resources不是powershell变量,则需要转义'$'。尝试这种方式:

$str = "`$Resources:docliblist"

关于sharepoint - Powershell:使用SharePoint API,GetLocalizedString不返回任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9809128/

相关文章:

sharepoint - 文档库爬网

powershell - 如何使用 powershell 删除所有 Azure 资源

powershell - 新对象 : The term New-Object is not recognized as the name of a cmdlet

powershell - Powershell的颜色,弄乱了Vim + Solarized主题

powershell - 如何在字符串中有选择地覆盖/替换空格,如果给定索引处没有空格,则如何选择一个字符?

c# - 如何在 SharePoint 2010 中获取服务应用程序权限

SharePoint 解决方案部署 : How do I prevent SP from resetting IIS when upgrading or retracting a globally deployed solutions?

javascript - SharePoint REST 查询 SP.UserProfiles.PeopleManager

Powershell 固定宽度导出

ios - 在 SharePoint 2013 中,上传的视频无法在 ipad 和 iphone 上播放