Tuesday, July 9, 2013

Check Column exist in SharePoint List using Powershell

Sometimes when we are working with SharePoint list items will get an error like

Column has been deleted by another user or not exist.

for this we can use below code to check column exist or not

 foreach($list in $web.Lists)
      {
         if($list.BaseType -eq "DocumentLibrary")
         {
              if( $list.Fields.ContainsField("ddlTest") -eq $true)
               {                                       
               Write-Host "found" $list.title
               }
               else
               {
                #  Write-Host "not found"  
               }
         }
      }

No comments:

Post a Comment

Followers