Wednesday, January 20, 2021

Export yammer group members to a csv file

Note: This topic describes features in classic Yammer. For information on using this feature in the new Yammer, see Export Yammer community members to a .csv file.

You can export Yammer group members names and email addresses to a .csv file. This is useful if you want to see if anyone is missing from the group, invite all group members to another group, or contact members by email.

Any member of your Yammer network can export the information for public groups. For private groups, only members of the group and network admins can export the membership list.

Note: If your group is Microsoft 365-connected and you have access to the Azure Active Directory (Azure AD) portal, then you could follow the steps in Bulk download members of a group in Azure Active Directory instead of the steps below.

The process below requires using Windows PowerShell. It looks complicated, but takes just a few minutes to complete.

Step 1: Find the group ID

The group ID identifies the Yammer group. You need it for the PowerShell script.

Step 2: Find your token

Your token is an encrypted version of your account and password. You need it for the PowerShell script.

Step 3: Create your PowerShell script

Save the sample code in a file, and replace the values for the group ID and token.

Step 4: Run the PowerShell script

Change directories to the folder where you want the .csv file and paste your script into PowerShell.

Step 5: Open the .csv file with Excel

Use the full-name and email columns to get the list of members.

Step 1: Find the group ID

  1. In your browser, go to https://www.yammer.com.

  2. Select a group.

  3. Look in the browser's address bar, and copy the value for feedId to your NotePad file. For example, in the following URL, you would copy the value 1172163.

    https://www.yammer.com/contoso.com/#/threads/inGroup?type=in_group&feedId=1172163

Step 2: Find your token

Warning: Do not share your token with anyone else. It can be used to access your Yammer account.

  1. In a browser, go to https://www.yammer.com/client_applications.

  2. Click Register New App.

    • Application name: Since you won't be using this app for anything except getting your token, name it whatever you'd like. The application name must be unique.

    • Organization: Enter your company name.

    • Support email: Enter your work email address.

    • Website: Enter your company's website.

    • Redirect URI: Enter https://www.yammer.com.

    Details page for creating a new Yammer app

  3. In the Keys and token section, click Generate a developer token for this application.

    Yammer app page showing link to get token

    The token is shown at the bottom of the Keys and token page. It is shown blurred in the previous picture.

    The token can be used to access Yammer, so do not share it.

  4. Copy the token to a Notepad file.

    Yammer app page showing token

Step 3: Create your PowerShell script

Warning: Do not share this script after you enter your token. Your token can be used to access your Yammer account.

  1. Copy the following code into a Notepad file.

      $GroupId=group_id_value    $Token = "token_value"    $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 | Where {$_} | Export-Csv "$GroupId.csv" -Delimiter ","       	
  2. In the first two lines of the script, replace the group_id_value and token_value with the results from steps 1 and 2.

Step 4: Run your PowerShell script

  1. Open Windows PowerShell. For information abut finding Windows PowerShell, see Finding PowerShell in Windows 10, 8.1, 8.0 and 7.0

  2. In PowerShell, change directories to the place you want the .csv file to be saved. For example, if you want the script to be stored in your Documents folder, and your user name is Joe, type:

      cd c:\users\joe\documents
  3. Copy your script from your NotePad file, paste it into PowerShell, and press Enter.

Step 5: Open the file with Excel

  1. Double-click the Excel file, which will have the name GroupID.csv, using the group ID from step 1.

    This file will be in the directory from which you ran the PowerShell commands.

  2. Use the full-name and email columns to get the list of members.

No comments:

Post a Comment