用于保存内容类型的Powershell脚本 [英] Powershell script to save a content type

查看:78
本文介绍了用于保存内容类型的Powershell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙伴

我不是SharePoint人员,而是使用与SharePoint交互的产品。我需要一个简单的power shell脚本来遍历文档库并保存内容类型。

I'm not a SharePoint guy but work with a product which interact with SharePoint . I need a simple power shell script to traverse through the document library and save a content type .

场景如下,

文档库:Documents 此文档库中有许多文件夹

Document library : Documents  has many folders within this document library

应用的自定义内容类型  " ERP_Document"它有自定义列。

custom content type applied to Document is " ERP_Document" which has custom columns.

我需要一个脚本来运行文档库打开自定义内容类型,然后执行保存。

I need a script to run through the document library open the custom content type and just do a save.

我正在解决一个问题,我必须保存内容类型,问题就消失了。我无法手动完成,因为该库中有数千个文件夹/文档。

I'm troubleshooting an issue where I have to just save the content type and the problem goes away. I can't do it manually because there are thousand of folders/documents in that library.

我到目前为止。

==================================

==================================

Add-PSSnapin Microsoft.SharePoint.PowerShell

$ site = Get-SPSite -Identity http:// shareptsite

$ web = $ site.RootWeb

$ list = $ web.Lists [" Documents"]

Add-PSSnapin Microsoft.SharePoint.PowerShell
$site = Get-SPSite -Identity http://shareptsite
$web = $site.RootWeb
$list = $web.Lists["Documents"]

$ folderCTName =" Folder"

$ myCTId =" 0x01200XXXXXXXXXXXX300"

$folderCTName = "Folder"
$myCTId = "0x01200XXXXXXXXXXXX300"

推荐答案

您好Faisal44,

Hi Faisal44,

打开自定义内容类型并进行保存是什么意思?

What do you mean by open the custom content type and just do a save?

您的意思是,如果您手动执行此操作,则可以打开文件属性界面而不进行任何修改,然后单击"保存"。

Do you mean that if you do it manually, you can open the file properties interface without making any modifications and then click Save.

就像这样:

如果那是这种情况,因为您没有进行任何更改,我们无法使用Power shell命令执行保存的指令。

If that's the case, because you haven't made any changes, we can't do a saved instruction with the Power shell command.

作为一种解决方法,我重新开始建议您在将内容类型更改回要使用的内容类型之前,通过电源shell将内容类型更改为任何其他类型。

As a workaround, I recommend that you change the content type to any other one through the power shell before you change it back to the content type you want to use.

您可以参考上面提到的Power Shell命令以下文章:

You can refer to the Power Shell command mentioned in the following article:

http://www.sharepointdiary.com/2014/04/change-content-type-of-existing-items-in-sharepoint-using-powershell.html

祝你好运

Itch Sun


这篇关于用于保存内容类型的Powershell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆