Guest User

Untitled

a guest
Jan 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
  2.  
  3. [Microsoft.SharePoint.SPSite] $site = Get-SPSite http://test/site
  4.  
  5. foreach ($web in $site.AllWebs)
  6. {
  7. foreach ($list in $web.Lists)
  8. {
  9. if ($list.Fields.ContainsField("State"))
  10. {
  11. foreach ($item in $list.Items)
  12. {
  13. if ($item["State"] -eq "Texas")
  14. {
  15. # Add this to a CSV, or Write-Host, or whatever
  16. }
  17. }
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment