Hi, One of the requirements my team received was to extract project server related information to automate Project Servers permission for which we need to extract project server reports on daily basis.
Its very easy and simple to use Project Server Rest API with PowerShell to extract Projects information.
It involves three basic steps:-
Its very easy and simple to use Project Server Rest API with PowerShell to extract Projects information.
It involves three basic steps:-
- Invoke-Webrequest to Project server rest API endpoint.
- Parse the result into JSON.
- filter the Json result and output to excel.
Here is the script to perform this activity
$webRequest = Invoke-WebRequest -Uri "http://{site url}/pwa/_api/ProjectData/Projects"
-Headers @{"Accept"="application/json;odata=verbose"} -UseDefaultCredentials
$jsonData = $webRequest.Content | ConvertFrom-Json
$jsonData.d[0].results | Select ProjectTitle, ProjectOwnerName, ProjectId
|Export-Csv -Path c:\ProjectServerDataFinal.csv
And this will generate the csv file with desired input, you can get all these properties of project using basic Rest API uri and can also provide filters to as desired.
No comments:
Post a Comment