Two Ways to Export a List of Microsoft 365 Group Members

Two Ways to Export a List of Microsoft 365 Group Members

It’s easy to find instructions for exporting an Outlook Contact Group to a csv file, but there’s no built in way (as of today, at least) for an end user to export the membership of a Microsoft 365 (Office 365) Group.

Here are two ways it can be done, one for an Exchange Administrator via PowerShell and one for an end user via Microsoft Outlook.

Using PowerShell

If your an Exchange administrator, this method will work for you. This method lets you collect a lot more information about the group members if you modify the “Select” fields in the in the Get-UnifiedGroupLinks cmdlet.

  1. Connect to Exchange Online. You can find instructions for doing that at a million other websites, including Microsoft, so I won’t repeat them here.
  2. Save the group’s email address, name, or GroupID to a variable named “$Group”, like this:
    $Group = “My Office 365 Group”
  3. Copy and paste this code into PowerShell. Change the OutFile path and name to whatever works for you:
$LinkTypes = "Members","Owners"
$Outfile = "C:\Temp\" + $Group + ".csv"
$LinkTypes | Foreach {
    $LinkType = $_
    $Links += (Get-UnifiedGroupLinks -Identity $Group -LinkType $LinkType | Select DisplayName, PrimarySmtpAddress, ExternalEmailAddress, @{n='LinkType';e={$LinkType}})
$Links | Export-Csv $Outfile -NoTypeInformation
Remove-Variable Links

This will create a CSV file with a list of group members and owners like this:

Joe Smithjsmith@domain.comMember
Bob Johnsonbjohnson@domain.comOwner

Using Outlook

This method is best for end users who just need a list of members, but it won’t give you any extra information. This method does not work will in Outlook Online, so I recommend using the desktop client.

  1. Open Outlook desktop client and start a new email message.
  2. Add the group to the To field and click on the plus (+) sign next to the group name to expand the group into the individual members.
  3. Copy and paste the member list into a text file where you can format it however you want.

Your output will look something like this:

Joe Smith <>; <>; Bob Johnson <>

Not ideal, but it gets the job done. I would paste that into Notepad or another raw text editor first, then copy from there into Word in order to remove any formatting. You can use the Find and Replace function in Word to replace the semicolons with line feeds.

2 responses to “Two Ways to Export a List of Microsoft 365 Group Members”

  1. Andrew Ashurst says:

    The method for a user to get this from outlook is clumsy, but, I have to agree seems still to be the only way. I have made a routine with power query that can turn the list into a table with columns for Alias: Email: Surname: First Name and Name. It’s input is a one row table with three columns, first column “Column 1” row data “Alias and Email”, second column “List Len” row data, a LEN expression on the row data for the third column, third column “Name List” – the pasted list from outlook per your post above. The second column isn’t really necessary but enables me to say that this has coped with a 260 person list that pastes almost 12,000 characters into the data cell for col 3 (clearly that 256 cell character limit no longer applies). I tried posting the query code here but got an “it’s too long” message. Let me know if you’d like me to post it.

  2. Andrew Ashurst says:

    I do some tidying after this, but, this is the nub of it.

    Source = Excel.CurrentWorkbook(){[Name=”OutlookGrpAddressPaste”]}[Content],
    #”Removed Other Columns” = Table.SelectColumns(Source,{“Name List”}),
    #”Split Column by Delimiter” = Table.ExpandListColumn(Table.TransformColumns(#”Removed Other Columns”, {{“Name List”, Splitter.SplitTextByDelimiter(“;”, QuoteStyle.None), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), “Name List”),
    #”Split Column by Delimiter1″ = Table.SplitColumn(#”Split Column by Delimiter”, “Name List”, Splitter.SplitTextByDelimiter(“:”, QuoteStyle.Csv), {“Name List.1”, “Name List.2″}),
    #”Changed Type” = Table.TransformColumnTypes(#”Split Column by Delimiter1″,{{“Name List.1”, type text}, {“Name List.2″, type text}})
    #”Changed Type”

Leave a Reply

Your email address will not be published. Required fields are marked *