September 09, 2013

PowerShell add list filed to default list view in sharepoint

You have large number of sites and list so you will need this script to get your field to add to your list view. Every day your customer comes with new requirement for you happily running live environment its really important to get it done properly on All list as well bit hectic if you have lists in hundreds.

Here in example I am adding status filed in default task list view you can use below powershell script for any list view or field by updating code.

below script will log all activities in csv format as show below,

 1)  Will check list is present or not. 
 2)  Will check field is present or not. 
 3)  Check field is already in view or not. 

PowerShell script
 # Author : Praveen Pandit  
 # Purpose: Add Field to View  
 # Year  : 2013  
 # Powershell : 2.0  
      $spWeb = Get-SPWeb -Identity $siteURL.url  
      $lists = $spWeb.Lists["Tasks"]  

Please share any issue or findings on this.

Praveen Pandit

No comments:

Post a Comment