Skip to content

Commit 72c79ec

Browse files
committed
Add getprojectscsom.ps1 and getprojectsodata.ps1, also make it use increased timeout (120 seconds)
1 parent 7a5ce90 commit 72c79ec

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

ReST.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function Build-ReSTRequest([string] $siteUrl, [string]$endpoint, [string]$method
4949
{
5050
$url = ([string]$siteUrl).TrimEnd("/") + "/_api/" + $endpoint
5151
$req = [System.Net.WebRequest]::Create($url)
52+
$req.Timeout = 120000
5253
$req.Method = $method
5354

5455
[bool]$isReadOnly = (('GET','HEAD') -contains $req.Method)

getprojects.ps1 renamed to getprojectscsom.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ param
1717
Set-SPOAuthenticationTicket $siteUrl
1818
Set-DigestValue $siteUrl
1919

20-
# Get list of projects using OData ReST API
21-
"OData"
22-
Get-ReSTRequest $SiteUrl "ProjectData/Projects"
23-
2420
"CSOM"
2521
# Get list of projects using CSOM ReST API
2622
Get-ReSTRequest $SiteUrl "ProjectServer/Projects"

getprojectsodata.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<#
2+
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3+
See LICENSE in the project root for license information.
4+
#>
5+
6+
7+
# Get list of projects using OData/CSOM ReST API
8+
param
9+
(
10+
# SharepointOnline project site collection URL
11+
$SiteUrl = $(throw "SiteUrl parameter is required")
12+
)
13+
# Load ReST helper methods
14+
. .\ReST.ps1
15+
16+
# Set up the request authentication
17+
Set-SPOAuthenticationTicket $siteUrl
18+
Set-DigestValue $siteUrl
19+
20+
# Get list of projects using OData ReST API
21+
"OData"
22+
Get-ReSTRequest $SiteUrl "ProjectData/Projects"

0 commit comments

Comments
 (0)