Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $siteUrl="http://sp:20971/test1"
- $site = New-Object Microsoft.SharePoint.SPSite $siteUrl
- $ctName1 = "Finance Standards Documents"
- $ctName2 = "Finance Network Standards Documents"
- $ctName3 = "Document"
- $name="StdsDocStatus"
- $file="c:testpp4.csv"
- foreach ($web in $site.AllWebs) {
- foreach ($list in $web.Lists) {
- if ($list.BaseType -eq “DocumentLibrary”) {
- foreach ($ctype in $list.ContentTypes)
- {
- if ($ctype.Name -eq $ctName1 -or $ctype.Name -eq $ctName2 -or $ctype.Name -eq $ctName3)
- {
- if($list.Items.Count -ne 0){
- foreach($item in $list.items)
- {
- if($item[$name] -eq "Approved")
- {
- $item.Fields | foreach {
- $fieldValues = @{
- "Display Name" = $_.Title
- "Internal Name" = $_.InternalName
- "Value" = $item[$_.InternalName]
- }
- New-Object PSObject -Property $fieldValues | Select @("Display Name","Internal Name","Value")
- }|Export-Csv -Path $file
- }
- }
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment