Saturday, September 14, 2013

SharePoint List item do not update modified time and modified user

Hi,

I had a requirement to not update the modified user and modified date on the list items with the ability to update the items in the list.

This situation comes like in the production sharepoint sites, the documents modified time and modified by fields are updated by business users and while doing code executions on these items, those modified fields on the lists items should not be updated with system account and latest time.

For this, we used the item.systemupdate(true/false) method.

Here is the script, we had to run on each item in the document library in the entire site collection to make the item update , but without updating modified by and modified time.

Our requirement was to delete the minor versions in the entire site collection, so we recommended the approach of enabling version history with setting "Keep the following no of minor versions" to 1 or 2 or 3.

So if we set 1 for the setting, only the current published minor versions other published versions will exist and all other minor versions will be deleted.
But this job will be done only the item has to be checked out with check in /discard checkout action.

To avoid manual action on each item, we prepared the following script.



No comments: