SOLVED

Create a Dynamic Distribution List from members of an "Office 365 Group"

%3CLINGO-SUB%20id%3D%22lingo-sub-919035%22%20slang%3D%22en-US%22%3ECreate%20a%20Dynamic%20Distribution%20List%20from%20members%20of%20an%20%22Office%20365%20Group%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-919035%22%20slang%3D%22en-US%22%3E%3CP%3EHello.%26nbsp%3B%20I%20have%20been%20asked%20to%20nest%20an%20Office%20365%20Group%20into%20a%20distribution%20list%2C%20but%20I%20don't%20believe%20this%20is%20possible.%26nbsp%3B%20I%20had%20the%20bright%20idea%20that%20I%20could%20create%20a%20Dynamic%20Distribution%20List%20from%20the%20members%20of%20the%20UnifiedGroup%2C%20but%20my%20command%20is%20returning%200%20members.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20got%20the%20below%20CN%20from%20PowerShell%20using%3A%3C%2FP%3E%3CP%3E%22get-unifiedgroup%20(groupname)%20%7Cfl%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%3A%26nbsp%3B%3C%2FP%3E%3CP%3Ememberofgroup%20-eq%20%22CN%3D(groupname)_539b0afa-fa6e-4cfe-a3bb-e91cf0d435f0%2COU%3D(companydomain).onmicrosoft.com%2COU%3DMicrosoft%20Exchange%20Hosted%20Organizations%2CDC%3DNAMPR01A004%2CDC%3Dprod%2CDC%3Doutlook%2CDC%3Dcom%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20%22memberofgroup%22%20functional%20for%20members%20of%20UnifiedGroups%20(Office%20365%20Group)%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoug%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-919035%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-919273%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Dynamic%20Distribution%20List%20from%20members%20of%20an%20%22Office%20365%20Group%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-919273%22%20slang%3D%22en-US%22%3EYou%20can%20only%20use%20AD%20attributes%20such%20as%20notes%2FTitle%2Fmanager%20etc.%20or%20the%2015%20custom%20attributes%20to%20build%20Dyn%20Distro's%20and%20Dynamic%20groups%2C%20you%20can't%20use%20group%20memberships%20of%20other%20groups%20to%20build%20those%20out.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-919916%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Dynamic%20Distribution%20List%20from%20members%20of%20an%20%22Office%20365%20Group%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-919916%22%20slang%3D%22en-US%22%3E%3CP%3EWhat's%20the%20entire%20cmdlet%3F%20Here's%20an%20example%20that%20works%20just%20fine%20for%20me%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EGet-Mailbox%20-Filter%20%22MemberOfGroup%20-eq%20'CN%3Ddefault_8d405d20-65d9-4650-abca-352770e4438b%2COU%3Dtenant.onmicrosoft.com%2COU%3DMicrosoft%20Exchange%20Hosted%20Organizations%2CDC%3DEURPR03A001%2CDC%3Dprod%2CDC%3Doutlook%2CDC%3Dcom'%22%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20you%20can%20use%20the%20same%20filter%20for%20a%20DDG.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869%22%20target%3D%22_blank%22%3E%40Chris%20Webb%3C%2FA%3E%20that's%20not%20true%2C%20those%20are%20simply%20the%20attributes%20exposed%20in%20the%20UI%2C%20but%20you%20can%20use%20pretty%20much%20anything%20for%20the%20recipientfilter%20query%20if%20you%20do%20it%20via%20PowerShell.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-919935%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Dynamic%20Distribution%20List%20from%20members%20of%20an%20%22Office%20365%20Group%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-919935%22%20slang%3D%22en-US%22%3EWell.%20Learned%20something%20new.%20Docs%20never%20mentioned%20that.%20Good%20to%20know!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-928171%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Dynamic%20Distribution%20List%20from%20members%20of%20an%20%22Office%20365%20Group%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-928171%22%20slang%3D%22en-US%22%3E%3CP%3EOk%2C%20I%20figured%20it%20out%20using%20powershell.%20%3A)%3C%2Fimg%3E%26nbsp%3B%20The%20key%20turned%20out%20to%20be%20the%20recipientfilter%20needed%20the%20recipientType%20and%20memberofgroup%20attributes%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ENew-DynamicDistributionGroup%3C%2FSTRONG%3E%20-Name%20%22MyDDG%22%20-RecipientFilter%20%7B((%3CSTRONG%3ERecipientType%3C%2FSTRONG%3E%20-eq%20'UserMailbox')%20-and%20(%3CSTRONG%3EmemberOfgroup%3C%2FSTRONG%3E%20-eq%20%22CN%3DMyO365Group_430c61d4-7b32-4b35-957b-644912193d28%2COU%3DMyCompany.onmicrosoft.com%2COU%3DMicrosoft%20Exchange%20Hosted%20Organizations%2CDC%3DNAMPR01A004%2CDC%3Dprod%2CDC%3Doutlook%2CDC%3Dcom%22))%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWorks%20like%20a%20charm.%3C%2FP%3E%3CP%3EThanks%20for%20looking!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoug%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hello.  I have been asked to nest an Office 365 Group into a distribution list, but I don't believe this is possible.  I had the bright idea that I could create a Dynamic Distribution List from the members of the UnifiedGroup, but my command is returning 0 members.

 

I got the below CN from PowerShell using:

"get-unifiedgroup (groupname) |fl"

 

I am trying: 

memberofgroup -eq "CN=(groupname)_539b0afa-fa6e-4cfe-a3bb-e91cf0d435f0,OU=(companydomain).onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=NAMPR01A004,DC=prod,DC=outlook,DC=com"

 

Is "memberofgroup" functional for members of UnifiedGroups (Office 365 Group)?

 

Thank you,

 

Doug

 

4 Replies
Highlighted
You can only use AD attributes such as notes/Title/manager etc. or the 15 custom attributes to build Dyn Distro's and Dynamic groups, you can't use group memberships of other groups to build those out.
Highlighted

What's the entire cmdlet? Here's an example that works just fine for me:

 

Get-Mailbox -Filter "MemberOfGroup -eq 'CN=default_8d405d20-65d9-4650-abca-352770e4438b,OU=tenant.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR03A001,DC=prod,DC=outlook,DC=com'"

 

And you can use the same filter for a DDG.

 

@Chris Webb that's not true, those are simply the attributes exposed in the UI, but you can use pretty much anything for the recipientfilter query if you do it via PowerShell.

Highlighted
Well. Learned something new. Docs never mentioned that. Good to know!
Highlighted
Best Response confirmed by DougTraylor (Occasional Contributor)
Solution

Ok, I figured it out using powershell. :)  The key turned out to be the recipientfilter needed the recipientType and memberofgroup attributes>

 

New-DynamicDistributionGroup -Name "MyDDG" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and (memberOfgroup -eq "CN=MyO365Group_430c61d4-7b32-4b35-957b-644912193d28,OU=MyCompany.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=NAMPR01A004,DC=prod,DC=outlook,DC=com"))}

 

Works like a charm.

Thanks for looking!

 

Doug