Skip to content

Instantly share code, notes, and snippets.

@carlosdoliveira
Created September 21, 2020 12:59
Show Gist options
  • Save carlosdoliveira/1b4538f20d605481834c4fe0ebac6e46 to your computer and use it in GitHub Desktop.
Save carlosdoliveira/1b4538f20d605481834c4fe0ebac6e46 to your computer and use it in GitHub Desktop.
$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