The following is the code snippet which is used to do the versioning settings.
///Enable Versioning to lists
SPContext.Current.Web.AllowUnsafeUpdates = true;
SPList objList = SPContext.Current.Web.Lists["TestList"];
//EnableVersioning:- True if versioning is enabled for the document library; Otherwise false.
objList.EnableVersioning = true;
//EnableMinorVersions:- true if minor versions are enabled when versioning is enabled for the document library; otherwise false.
objList.EnableMinorVersions = true;
//EnableModeration: property is true if Content Approval is enabled; otherwise, false
objList.EnableModeration = true;
//ForceCheckout:- This property is true if Forced checkout is enabled for the document library; otherwise false
objList.ForceCheckout = true;
//DraftVersionVisibility:- Set the accessibilty of the minor versions of document drafts within the list.
objList.DraftVersionVisibility = DraftVisibilityType.Author;
objList.Update();
SPContext.Current.Web.AllowUnsafeUpdates = false;
I am William..I just browsing through some blogs and came across yours!Excellent blog, good to see someone actually uses for quality posts.Your site kept me on for a few minutes unlike the rest :)Keep up the good work!Thanks for sharing a important information on sharepoint
ReplyDelete