Author Posts

September 28, 2017 at 8:45 am

Hi,

I am trying to add an external contact to a distribution group but it keeps failing,

I have successfully added others but for one particular user it doesn't let me. the error I get is:

Couldn't find object "username@test.co.uk". Please make sure that it was spelled correctly or specify a different
object.
+ CategoryInfo : NotSpecified: (:) [Add-DistributionGroupMember], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : [Server=HE1PR0201MB2027,RequestId=8b090dc3-57a5-4fa4-8ee4-7b25e02e2654,TimeStamp=28/09/2
017 08:30:09] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] E2D3724,Microsoft.Exchange.Management.Rec
ipientTasks.AddDistributionGroupMember
+ PSComputerName : outlook.office365.com

September 28, 2017 at 9:03 am

Do you have such contact ?
Get-Contact | ? { $_.WindowsEmailAddress -eq 'username@test.co.uk' }

September 28, 2017 at 9:21 am

hi..

no I have amended the email address as I didn't want to show what the users email is

Do you want me to run the above code?

September 28, 2017 at 9:23 am

i ran the above code and it didn't return anything

September 28, 2017 at 2:17 pm

Help:
The Member parameter specifies the recipient (mail-enabled object) that you want to add to the group. You can use any value that uniquely identifies the recipient.

you can add existing contacts to distribution list, not just email address, so create contact and add it 🙂

September 28, 2017 at 2:41 pm

Hey Siddra

Have you created the contact for the person that you are adding to a distribution group?
You will have to create a contact (or mail user) if the person has an external email.
Then add it to the Distribution List?
e.g

New-MailContact -Name "Chris Ashton" -ExternalEmailAddress "chris@tailspintoys.com"
Add-DistributionGroupMember -Identity "GroupName" -Member "Chris Ashton"

September 29, 2017 at 7:14 am

Hi,

Yes I first tried to create the contact list and it keeps throwing an error. the error i get is:

Active Directory operation failed on HE1PR02A005DC04.EURPR02A005.PROD.OUTLOOK.COM. The object 'CN=Emma
Broady,OU=trinityacademyhalifax.onmicrosoft.com,OU=Microsoft Exchange Hosted
Organizations,DC=EURPR02A005,DC=PROD,DC=OUTLOOK,DC=COM' already exists.
+ CategoryInfo : NotSpecified: (:) [New-MailContact], ADObjectAlreadyExistsException
+ FullyQualifiedErrorId : [Server=HE1PR0201MB2027,RequestId=a95d4a24-05e3-4fb0-8932-9363822c594a,TimeStamp=29/09/2
017 07:12:17] [FailureCategory=Cmdlet-ADObjectAlreadyExistsException] 334F5F7,Microsoft.Exchange.Management.Recipi
entTasks.NewMailContact
+ PSComputerName : outlook.office365.com

September 29, 2017 at 6:12 pm

I see. It looks like you already have the Contact created.
If you have Office 365 AD connect/DirSync running and all your on-premise AD synchronises to Office365 or Azure AD, then you can easily add the Contact (AD object) into the Distribution Group (again AD object) on your local ActiveDirectory Users and Computers. This will then sync across office 365.

Or, if you manage all your Contact/MailUser and Distribution Group on the office 365 then try
Get-MailContact -Identity "Chris Ashton" | Format-List
If it returns the right value then you should be able to Add-DistributionGroupMember

If this still fails, I will submit a support request on office 365 portal.
Hope this helps!