次の方法で共有


ContentTypeCollection クラス

ワークフローの関連付けによって使用されるワークフロー履歴リストを指定する値を取得または設定します。

継承階層

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.ClientObjectCollection
      Microsoft.SharePoint.Client.ClientObjectCollection<ContentType>
        Microsoft.SharePoint.Client.ContentTypeCollection

名前空間:  Microsoft.SharePoint.Client
アセンブリ:   Microsoft.SharePoint.Client.Silverlight (Microsoft.SharePoint.Client.Silverlight.dll 内);  Microsoft.SharePoint.Client.Phone (Microsoft.SharePoint.Client.Phone.dll 内)  Microsoft.SharePoint.Client (Microsoft.SharePoint.Client.dll 内)

構文

'宣言
Public NotInheritable Class ContentTypeCollection _
    Inherits ClientObjectCollection(Of ContentType)
'使用
Dim instance As ContentTypeCollection
public sealed class ContentTypeCollection : ClientObjectCollection<ContentType>

注釈

Document library templates sample app for SharePointでは、このオブジェクトを使用する方法を示します。

次の例は、ユーザー設定のコンテンツ タイプを初期化、コンテンツの種類のコレクションに追加し、web サイトのコンテンツ タイプの名前を表示します。

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class ContentTypeCollectionExample
    {
        static void Main()
        {

            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            ContentTypeCollection collContentType = site.ContentTypes;

            // Initialize a new content type.
            ContentTypeCreationInformation contentInfo = new ContentTypeCreationInformation();
            contentInfo.Name = "myContentType";
            contentInfo.Description = "My custom content type";
            ContentType contentType = collContentType.Add(contentInfo);

            clientContext.Load(collContentType);
            clientContext.ExecuteQuery();

            foreach (ContentType myType in collContentType)
                Console.WriteLine("Content Type Name: {0}", myType.Name);
        }

    }
}

スレッド セーフ

この型のパブリック static (Visual Basic のShared ) メンバーはいずれもスレッド セーフです。インスタンス メンバーはスレッド セーフになるという保証はありません。

関連項目

参照先

ContentTypeCollection メンバー

Microsoft.SharePoint.Client 名前空間