Wednesday, 2 May 2012

SharePoint 2007: Script to change List items values for a specific field

When you have an extensive Sharepoint list, and for some reason you need to change the value of the list items, it is handy to have a script for such job. The following script to changes a field value for all items in a SharepPoint list.

To use the script:
 Go to the live Sharepoint server
Place the script TamTam.SharePoint.ChangeContentTypeScript.exe”  in the C:\SharepointScripts folder
Run the script:
TamTam.SharePoint.ChangeContentTypeScript.exe SPListURL LisName FieldName FieldValue
Ex:
 TamTam.SharePoint.ChangeContentTypeScript.exe http://mossdev/news/ Pages  NewsCategory MediaIntranet
If you wish to change the value only when a certain value already exists, for instance if a field named NewsType has the value “MediaIntranet”, should be changed to “Intranet”, do the following:

a. TamTam.SharePoint.ChangeContentTypeScript.exe http://mossdev/news/ Pages  NewsCategory MediaIntranet Intranet
b. TamTam.SharePoint.ChangeContentTypeScript.exe SPListURL LisName FieldName FieldValue NewFieldValue
Below are the executable and the source code for this script:

TamTam.SharePoint.ChangeFieldValue.exe.zip (3.24 KB)TamTam.SharePoint.ChangeFieldValue.source.zip (15.88 KB)

No comments: