Hi,
I have a scheduled job in SharePoint 2013 environment, where I export SharePoint list Items as csv. I would like to use a SharePoint list View so that I get all the items from the view into csv. I tried below
script and it only returns items that are in the first paginated view. The view has an item limit of 50 items. But I wan't to return all the items in the view.
Please help me modify the script accordingly. Thank you.
#Retrieving the Web Site with List
$MyWeb = Get-SPWeb "http://mysite/sites/testsite"
#Get the List name
$MyList = $MyWeb.Lists["Programs"]
#Get The View
#Change the name of the view
$MyView = $MyList.Views["My View"]
#Get the Items from the view
$MyItems = $MyList.GetItems($MyView)
#Get Specific field items and export it to a csv file
$MyItems | %{ select-object -input $_ -prop @{Name='ID';expression={$_.ID;}},
@{Name='Content Type';expression={$_["P. Type"];}},
@{Name='Program Name';expression={$_["Program Name"];}},
@{Name='Classifications';expression={($_["Classifications"]).substring(($_
["Classifications"]).IndexOf("#")+1);}},
@{Name='Classifications ID';expression={($_["Classifications"]).split(";")[0];}},
@{Name='VP';expression={($_["VP Owner"]).substring(($_["VP Owner"]).IndexOf("#")+1);}},
@{Name='VP ID';expression={($_["VP Owner"]).split(";")[0];}},
@{Name='Project Manager';expression={$_["Project Manager"];}},
@{Name='GL Project Code';expression={$_["GL Project Code"];}},
@{Name='Segment BU';expression={($_["Segment BU"]).substring(($_["Segment BU"]).IndexOf
("#")+1);}},
@{Name='Segment BU ID';expression={($_["Segment BU"]).split(";")[0];}},
@{Name='C-Product Line';expression={$_["C-Product Line"];}},
@{Name='Node and Foundry';expression={($_["Node and Foundry"]).substring(($_["Node and
Foundry"]).IndexOf("#")+1);}},
@{Name='Node and Foundry ID';expression={($_["Node and Foundry"]).split(";")[0];}},
@{Name='Phase';expression={$_["Phase"];}},
@{Name='Program Activity';expression={$_["Program Activity"];}},
@{Name='Archive';expression={$_["Archive"];}}; } | Export-Csv -Path "c:\Dashboard.csv"