无法在SharePoint 2007中使用文件夹内容类型
-
13-11-2019 - |
题
我有一个未密封的网站,并将列添加到内容类型,“文件夹”。现在,我想将此内容类型添加到文档库,但我没有选择在文档库设置中添加它 - >从现有站点内容类型添加。我没有看到“组”下拉菜单中的“文件夹内容类型”。此外,如果我将内容类型移动到另一个在此下拉列表中显示的组,则它仍然没有出现。是否有一些我必须做的是让这个内容键入我的文档库或选择哪个内容类型组可用于网站的地方?
非常感谢
解决方案
如果您创建了自己的内容类型,它将发布/激活到SharePoint,则应可供使您添加到文档库。只需确保您的文档库配置为支持内容类型。
在文档库设置的“高级设置”部分中,选择“世代odiceTagcode”下的“生成的Yes
”然后按照您继续。设置 - >从现有站点内容类型添加..
您可以使用控制台应用程序(ref msdn )添加内容类型到您网站上的列表。它还为您提供有关当前事物状态的有用消息。
.class Program {
static void Main(string[] args) {
using (SPSite siteCollection = new SPSite("http://YOUR_SPSITE")) {
using (SPWeb site = siteCollection.OpenWeb() {
// Get a content type.
SPContentType ct = site.AvailableContentTypes["YOUR_CONTENT_NAME"];
// The content type was found.
if (ct != null)
// Get a list.
try {
SPList list = site.Lists["YOUR_DOCUMENT_LIBRARY_NAME"]; // Throws exception if does not exist.
// Make sure the list accepts content types.
list.ContentTypesEnabled = true;
// Add the content type to the list.
if (!list.IsContentTypeAllowed(ct))
Console.WriteLine("The {0} content type is not allowed on the {1} list",
ct.Name, list.Title);
else if (list.ContentTypes[ct.Name] != null)
Console.WriteLine("The content type name {0} is already in use on the {1} list",
ct.Name, list.Title);
else
list.ContentTypes.Add(ct);
}
catch (ArgumentException ex) // No list is found.
{
Console.WriteLine("The list does not exist.");
}
else // No content type is found.
Console.WriteLine("The content type is not available in this site.");
}
}
Console.Write("\nPress ENTER to continue...");
Console.ReadLine();
}
}