다음을 통해 공유


ContentTypeAttribute.Id Property

Gets or sets the ID of the content type.

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

Syntax

'Declaration
Public Property Id As String
    Get
    Set
'Usage
Dim instance As ContentTypeAttribute
Dim value As String

value = instance.Id

instance.Id = value
public string Id { get; set; }

Property Value

Type: System.String
A String that represents the ID of the content type.

Remarks

This property must be set.

If the content type is an implicit (list-scoped), its ID value is the same as the ID of the defined content type from which it inherits.

Content type IDs are hard to read. For more readable code, you should also set the Name property.

SPMetal, which we recommend that you use, automatically sets both the Id and Name properties on the ContentTypeAttribute decorations that it generates.

Examples

The following shows Id in use:

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

    // Member declarations omitted.
}

See Also

Reference

ContentTypeAttribute Class

ContentTypeAttribute Members

Microsoft.SharePoint.Linq Namespace