-
Notifications
You must be signed in to change notification settings - Fork 2
Defining content type
SharePoint content type is associated to a model class by an SPContentTypeAttribute
attribute.
The attribute defined base content type and a unique content type ID.
The following defines a custom content type base on built-in Item content type,
named “My Item” and has the content type ID 0x01005A132C01F46341319BBA6C776A2D9D32
.
[SPContentType("5A132C01F46341319BBA6C776A2D9D32", "My Item")]
public class MyItem : SPModel {
}
Inheriting other built-in content types is also possible.
The following example defines a custom content type base on Document content type with ID
0x010100B74C4D49D7D44B0893B41D0163B8EC6E
.
[SPContentType(BuiltInContentTypeIdString.Document, "B74C4D49D7D44B0893B41D0163B8EC6E", "My Document")]
public class MyDocument : SPModel {
}
Note: It is also possible to describe built-in or third-party content types using models. For information see Built-in or third-party content type.
Next you would define columns in the content type.
-
Working with list items
-
Advanced model class usage
-
Other features