Export (0) Print
Expand All

ContentTypeAttribute class

Specifies that the class maps to a Microsoft SharePoint Foundation content type.

System.Object
  System.Attribute
    Microsoft.SharePoint.Linq.ContentTypeAttribute

Namespace:  Microsoft.SharePoint.Linq
Assembly:  Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)

[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false)]
public sealed class ContentTypeAttribute : Attribute

The content type being represented need not be a defined content type on the SharePoint Foundation Web site. When a site owner adds a column to an existing list, he creates a new implicit content type. That kind of implicit content type is also represented by classes decorated with a ContentTypeAttribute.

The following is an example of a ContentTypeAttribute used to map a TeamMembersItem class to the content type of a Team Members list.


[ContentType(Name="Item", Id="0x01", List="Team Members")]
[DataContract()]
public partial class TeamMembersItem : Item {

    // Member declarations omitted.
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft