Created
September 21, 2020 12:59
-
-
Save carlosdoliveira/1b4538f20d605481834c4fe0ebac6e46 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
$GroupId="########" | |
<# | |
Client ID: | |
Client Secret: | |
Dev Key: | |
#> | |
$Token = "" | |
$Headers = @{ "Authorization" = "Bearer "+$Token } | |
$GroupCycle = 1 | |
DO | |
{ | |
$GetMoreGroupsUri = "https://www.yammer.com/api/v1/users/in_group/$GroupId.xml?page=$GroupCycle" | |
write-host ("REST API CALL : $GetMoreGroupsUri") | |
[xml]$Xml = ((Invoke-WebRequest -Uri $GetMoreGroupsUri -Method Get -Headers $Headers).content) | |
$YammerGroups += $Xml.response.users.user | |
$GroupCycle ++ | |
$GroupCount += $Xml.response.users.user.count | |
write-host ("GROUPMEMBER COUNT : $GroupCount") | |
} | |
While ($Xml.response.users.user.count -gt 0) | |
$YammerGroups | Export-Csv "$GroupId.csv" -Delimiter "," |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment