SharePoint 2007でフォルダのコンテンツタイプを利用できません
-
13-11-2019 - |
質問
私は私がコンテンツタイプ '' folder 'に隠されて追加された列を持っているサイトを持っています。さて、このコンテンツタイプをドキュメントライブラリに追加したいが、ドキュメントライブラリの設定 - >既存のサイトコンテンツタイプから追加するオプションはありません。[グループ]ドロップダウンメニューの[フォルダのコンテンツタイプ]を見ていません。また、このドロップダウンに表示された別のグループにコンテンツの種類を移動した場合は、まだ表示されません。このコンテンツをこのコンテンツにするために必要なものは、私の文書ライブラリの選択を選択するか、またはどのコンテンツタイプのグループがサイトに使用可能かを選択する場所を選択しますか?
ありがとうございました
解決
独自のコンテンツタイプを作成し、それがSharePointに公開/有効化された場合は、文書ライブラリに追加することができます。文書ライブラリがコンテンツタイプをサポートするように構成されていることを確認してください。
ドキュメントライブラリ設定の詳細設定セクションで、Yes
の下にあるAllow management of content types?
を選択してから続行します。設定 - >既存のサイトコンテンツタイプから追加します。
コンソールアプリケーションを使用できます(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();
}
}