问题描述
我们有数百个文档库,分布在MOSS 2007 SharePoint网站的各个网站集中.
We have hundreds of document libraries, spread all throughout various site collections in a MOSS 2007 SharePoint site.
问题是,除了新文档"和新文件夹"内容类型之外,我还想添加内容类型:链接到文档"内容类型(0x01010A).这种新的内容类型应该适用于所有现有和新的文档库.
The problem is, that I want to add Content Type to show up in addition to the "New Document" and "New Folder" content types: the "Link to a Document" content type (0x01010A). This new content type should should up for all existing and new document libraries.
我尝试过的事情:
我认为我可以将以下内容添加到<ContentTypes></ContentTypes>
节点内部的schema.xml中:
I thought that I would be able to add the following to a schema.xml somewhere inside the <ContentTypes></ContentTypes>
node:
<!-- Link to Document Content Type -->
<ContentTypeRef ID="0x01010A" />
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\Publishing\Pages\schema.xml
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\DocumentLibrary\DocLib\schema.xml
这似乎已将内容类型添加到库中,确定,但是它并未显示在新建"菜单下(仍然仅显示文档"和文件夹"内容类型).如果我设置为允许管理内容类型?"设置为是",它就会显示出来.
This seems to have added the content type to the libraries OK, but it doesn't show up under the New menu (still just displays the "Document" and "Folder" content types). If I set "Allow management of content types?" to "Yes" then it shows up.
tl;博士
问::如何将链接到文档"内容类型添加到所有文档库中,并将其显示在新建"菜单中?
Q: How do I add the "Link to a Document" content type to all document libraries and have it show up in the New menu?
推荐答案
进行更多调查后,我发现通过更改..\12\TEMPLATE\FEATURES\DocumentLibrary\DocLib\schema.xml
可以将链接到文档"内容类型添加到所有新文档库中.更改schema.xml,然后执行IISRESET不会更改现有的库.
After doing some more investigation, I found out that by changing ..\12\TEMPLATE\FEATURES\DocumentLibrary\DocLib\schema.xml
I could add the Link to a Document content type to all NEW document libraries. Changing the schema.xml and then doing an IISRESET did not change existing libraries.
为此,我的schema.xml的开始看起来像这样:
In order to do this, the beginning of my schema.xml looked something like this:
<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="$Resources:shareddocuments_Title;" Direction="$Resources:Direction;" Url="Shared Documents" BaseType="1" EnableContentTypes="TRUE">
<!-- Link to Document Content Type - Added EnableContentTypes="TRUE" -->
<MetaData>
<ContentTypes>
<ContentTypeRef ID="0x0101">
<Folder TargetName="Forms/Document" />
</ContentTypeRef>
<ContentTypeRef ID="0x0120" />
<!-- Link to Document Content Type -->
<ContentTypeRef ID="0x01010A" />
</ContentTypes>
由于这不会更改现有文档库,因此我需要编写一个控制台应用程序,该应用程序使用其他两个答案中指定的代码来更新每个库.
Since this didn't change existing document libraries, I will need to write a console application that uses the code specified in the other two answers to update each library.
这篇关于将内容类型添加到所有文档库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!