Forum Discussion
How do I add a guest mail user to adress lists or create a mail contact using the same email address
- Dec 07, 2017
To be honest, it's a bit of a mess as you can actually have the same address added twice:
[10:36:59][Login script]# Get-Recipient tempxxx@abv.bg | Ft Name,RecipientType* Name RecipientType RecipientTypeDetails ---- ------------- -------------------- temp MailContact MailContact tempxxx_abv.bg#EXT# MailUser GuestMailUser
The "trick" is to have the contact first, then provision the Guest account. Doesn't really make much sense to me, but TonyRedmond seems to see the logic in all this and perhaps can explain it better :)
You have to get Access to Office 365 Exchange
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
And this is the command to add the Guest User to the list
Add-DistributionGroupMember -identity [GroupName] -Member [UserMailAdress]
The important thing is to add the same email address used for the guest account to the distribution list. This example is from Chapter 12 of the Office 365 for IT Pros eBook. Azure AD is looked up to retrieve the address to make sure that we use the right one:
Add-DistributionGroupMember -Identity DL1 -Member (Get-AzureADUser -ObjectId stale.hansen_cloudway.no#EXT#@office365itpros.onmicrosoft.com).Mail