SharePoint – REST Interface, JSON output

REST and JSON are hot these days, prior to SOAP and XML.

Luckily for PowerShell scripters, SharePoint has an REST interface.

And PowerShell has a JSON class.

Here is an example on how to combine both.


$creds = Get-Credential # get and save credentials

$url = "http://YourSite/_vti_bin/listdata.svc/YourList"

# Once you have the URI set,
# you can use the Invoke-RestMethod cmdlet to get the required information back:
# -UseDefaultCredentials or -Credential $cred

$ListService = Invoke-RestMethod -Uri $URL -Credential $cred

echo $ListService | select ID, Name | ConvertTo-Json

If you have more examples let’s please share.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: