-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-SlideShareUserSlideShow.ps1
53 lines (43 loc) · 1.99 KB
/
Get-SlideShareUserSlideShow.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Get-SlideShareUserSlideShow.ps1
# Get the Slideshows by the specified user
#
# Dec 2014
# If this works, this was written by Victor Vogelpoel ([email protected])
# If it doesn't work, I don't know who wrote this.
function Get-SlideShareUserSlideShow
{
[CmdletBinding()]
param
(
[Parameter(Position=0, Mandatory=$true, HelpMessage="Username of owner of slideshows")]
[ValidateNotNullOrEmpty()]
[string]$UserNameFor,
[Parameter(Position=1, Mandatory=$false, HelpMessage="Credential (username, password) of requesting user")]
[PSCredential]$RequestingUser,
[Parameter(Position=2, Mandatory=$false, HelpMessage="Specify the number of slideshows to return")]
[int]$Limit = 10,
[Parameter(Mandatory=$false, HelpMessage="Specify offset")]
[int]$Offset = 0,
[Parameter(Mandatory=$false, HelpMessage="Return a detailed response")]
[switch]$Detailed,
[Parameter(Mandatory=$false, HelpMessage="Whether or not to include unconverted slideshows")]
[switch]$GetUnconverted
)
# Get the validation data for the API call
$APIValidation = Get-SSAPIValidation
# Construct the query url
$slideshareAPIGetSlideShowsForUserUri = "https://www.slideshare.net/api/2/get_slideshows_by_user?username_for=$UserNameFor&limit=$Limit&api_key=$($APIValidation.APIKey)&hash=$($APIValidation.Hash)&ts=$($APIValidation.TimeStamp)"
# Now query the SlideShare API for user user slides
Write-Verbose "Query SlideShare API: $slideshareAPIGetSlideShowsForUserUri"
$slideShareData = Invoke-RestMethod -uri $slideshareAPIGetSlideShowsForUserUri
if ($slideShareData.SelectSingleNode('SlideShareServiceError'))
{
# ERROR
throw ( $slideShareData.SlideShareServiceError.Message | foreach { $_.'#text' } )
}
elseif ([int]($slideShareData.SelectSingleNode('User/Count').'#text') -gt 0)
{
# TODO Convert XML to objects
Write-Output $slideShareData.User.Slideshow
}
}