Guest User

Untitled

a guest
Jan 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. $siteUrl="http://sp:20971/test1"
  2. $site = New-Object Microsoft.SharePoint.SPSite $siteUrl
  3. $ctName1 = "Finance Standards Documents"
  4. $ctName2 = "Finance Network Standards Documents"
  5. $ctName3 = "Document"
  6. $name="StdsDocStatus"
  7. $file="c:testpp4.csv"
  8.  
  9. foreach ($web in $site.AllWebs) {
  10. foreach ($list in $web.Lists) {
  11. if ($list.BaseType -eq “DocumentLibrary”) {
  12.  
  13. foreach ($ctype in $list.ContentTypes)
  14. {
  15.  
  16. if ($ctype.Name -eq $ctName1 -or $ctype.Name -eq $ctName2 -or $ctype.Name -eq $ctName3)
  17. {
  18.  
  19.  
  20. if($list.Items.Count -ne 0){
  21.  
  22. foreach($item in $list.items)
  23.  
  24. {
  25.  
  26. if($item[$name] -eq "Approved")
  27. {
  28. $item.Fields | foreach {
  29. $fieldValues = @{
  30. "Display Name" = $_.Title
  31. "Internal Name" = $_.InternalName
  32. "Value" = $item[$_.InternalName]
  33. }
  34.  
  35. New-Object PSObject -Property $fieldValues | Select @("Display Name","Internal Name","Value")
  36.  
  37. }|Export-Csv -Path $file
  38.  
  39.  
  40.  
  41. }
  42.  
  43. }
  44.  
  45.  
  46. }
  47. }
  48.  
  49.  
  50.  
  51.  
  52. }
  53. }
  54.  
  55.  
  56. }
  57. }
Add Comment
Please, Sign In to add comment