-
Notifications
You must be signed in to change notification settings - Fork 2
Provisioning
Traditionally content types are deployed to SharePoint sites using XML definitions through SharePoint solutions and features.
The library has put the code-first idea onto SharePoint where your model classes describe the creations of content types, fields, and even lists and views. Then the library will create all the things needed when provisioning to SharePoint sites.
The library also handles any modifications to already deployed content types, fields and others and takes care of the tedious parts.
Defined content type can be provisioned onto a SharePoint site by calling SPModel.Provision()
.
If list is defined for that content type, a list is also created as per definition.
SPModel.Provision(typeof(Announcement), SPContext.Current.Web);
To add the defined content type to a specific list, you can use the overload:
SPModel.Provision(typeof(Announcement), SPContext.Current.Web.Lists["List to add"]);
Since if the described content type has already been provisioned before the library will try to syndicate all related definitions of the content type, columns, lists and views, below is the summary of the action taken:
Entry point | Existing CTs, columns, lists | New CTs, columns, lists |
---|---|---|
SPModel.Provision() |
Updated | Created |
first mentioned through SPModelManager per app domain |
Updated | - |
-
Working with list items
-
Advanced model class usage
-
Other features