Last active
September 6, 2016 22:42
-
-
Save darrenjrobinson/ec51b0545b618181adbbf24deb789c4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make my status Away | |
$postParams = @{availability="Away"} | convertto-json | |
$response = Invoke-WebRequest -Uri ($baseurl+$meurl.self.href+"/presence") -Method POST -Headers @{"Authorization"="Bearer $authcwt"} -Body $postParams -ContentType "application/json" -UseBasicParsing | |
# Make my status Busy | |
$postParams = @{availability="Busy"} | convertto-json | |
$response = Invoke-WebRequest -Uri ($baseurl+$meurl.self.href+"/presence") -Method POST -Headers @{"Authorization"="Bearer $authcwt"} -Body $postParams -ContentType "application/json" -UseBasicParsing | |
# Make my status Online | |
$postParams = @{availability="Online"} | convertto-json | |
$response = Invoke-WebRequest -Uri ($baseurl+$meurl.self.href+"/presence") -Method POST -Headers @{"Authorization"="Bearer $authcwt"} -Body $postParams -ContentType "application/json" -UseBasicParsing | |
# Make my status Do not disturb | |
$postParams = @{availability="Donotdisturb"} | convertto-json | |
$response = Invoke-WebRequest -Uri ($baseurl+$meurl.self.href+"/presence") -Method POST -Headers @{"Authorization"="Bearer $authcwt"} -Body $postParams -ContentType "application/json" -UseBasicParsing | |
# Get my Contacts | |
$response = Invoke-WebRequest -Uri ($baseurl+$peopleurl.myContacts.href) -Method Get -Headers @{"Authorization"="Bearer $authcwt"} -ContentType "application/json" -UseBasicParsing | |
$myContacts = $response.Content | ConvertFrom-Json | |
$myContacts._embedded.contact | Out-GridView | |
# Get the presense status of my contacts | |
$myContactsLinks = $(($response.content | ConvertFrom-JSON)._embedded.contact._links) | |
foreach ($contact in $myContactsLinks.contactPresence.href){ | |
$presense = Invoke-WebRequest -Uri $($baseurl+ $Contact) -method GET -Headers @{"Authorization"="Bearer $authcwt"} -ContentType "application/json" -UseBasicParsing #| ConvertFrom-JSON | Select -ExpandProperty availability | |
$contactPresense = $presense.Content | ConvertFrom-Json | |
write-host $Contact.split("/")[7..7] "is on a" $contactPresense.deviceType "and is" $contactPresense.availability | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment