You can enable moderation on a custom list by using this option under List Settings > Versioning Settings
Once this option is enabled, SharePoint creates two columns(Approval Status, Approval Comments) in a custom list to store the moderation status and comments.
When you write any migration scripts you'll have to take these columns into account as well otherwise all the migrated items will result to 'Pending' approval status.
In order to set these columns programmatically, I'll suggest that you use the following code:

One thing worth mentioning here, people often confuse 'SystemUpdate' with 'Update'. The 'SystemUpdate' will update the contents of a list without changing 'Modified', 'Created' datetime stamps. The update performed using 'SystemUpdate' will note create any additional version(if versioning is enabled). Where as 'Update' updates the 'Modified','Created' timestamps, user information(who has updated) along with the version history(if enabled).
I also noticed, when you create a custom list item inside a folder directory make sure the folder url is in the following format
folderurl: '/lists/{customlist}/{foldername}'.
****** there's no '/' in the end
Majid
No comments:
Post a Comment