SOLVED

Ability to customize Guest invitation emails

%3CLINGO-SUB%20id%3D%22lingo-sub-300541%22%20slang%3D%22en-US%22%3EAbility%20to%20customize%20Guest%20invitation%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-300541%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20a%20way%20to%20customize%20guest%20invitation%20emails%2C%20as%20pr.%20now%20a%20lot%20of%20our%20clients%2Fusers%20sees%20the%20invitation%20as%20some%20kind%20of%20spam%20and%20ignore%20it.%20It%20will%20help%20if%20we%20can%20customize%20the%20invitasjon%20to%20include%20our%20branding%20and%20customized%20text..ect%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-300541%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EActivity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAdministrator%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EGuest%20Access%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-301178%22%20slang%3D%22en-US%22%3ERe%3A%20Ability%20to%20customize%20Guest%20invitation%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-301178%22%20slang%3D%22en-US%22%3E%3CP%3ERe-reading%20your%20request%2C%20my%20solution%20isn't%20quite%20what%20you're%20wanting%2C%20but%20I%20think%20if%20you%20specify%20something%20clear%2Fobvious%20in%20the%20subject%20as%20well%20as%20the%20'From'%20address%20it%20should%20get%20you%20where%20you%20need%20to%20be%20and%20minimize%20any%20spam%2Fjunk%20problems.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20this%20is%20what%20gets%20sent%20to%20the%20users%20who%20request%20an%20external%20acct%20be%20created%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreetings%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20Office%20365%20External%20User%20Account%20that%20you%20requested%20has%20been%20created%2C%20and%20an%20invitation%20has%20been%20sent%20to%20the%20email%20address%20you%20provided.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EOnce%20they%20have%20received%20the%20Invitation%20E-Mail%2C%20they%20must%20accept%20the%20invitation%20by%20clicking%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E'Get%20Started'%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Elink%20in%20the%20e-mail.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EYou%20may%20wish%20to%20reach%20out%20to%20them%20personally%20to%20confirm%20they%20received%20and%20have%20accepted%20the%20invitation.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EFurther%2C%20you%20have%20been%20designated%20as%20the%20Manager%20for%20this%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eaccount%2C%20and%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewill%20be%20periodically%20contacted%20to%20see%20if%20the%20user%20still%20requires%20access.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EIf%2FWhen%20the%20user%20no%20longer%20requires%20access%2C%20please%20submit%20a%20service%20desk%20ticket%20to%20have%20the%20account%20removed.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EYou%20will%20receive%20a%20separate%20confirmation%20from%20the%20Remedy%20System%20when%20your%20incident%2Frequest%20ticket%20has%20been%20closed.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20contact%20the%20Service%20Desk%20if%20you%20require%20assistance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDo%20not%20reply%20to%20this%20email%2C%20as%20it%20was%20automatically%20generated%20and%20sent%20from%20an%20unmonitored%20address.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you.%3C%2FP%3E%3CP%3EITS%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-301177%22%20slang%3D%22en-US%22%3ERe%3A%20Ability%20to%20customize%20Guest%20invitation%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-301177%22%20slang%3D%22en-US%22%3E%3CP%3EHere's%20what%20I%20came%20up%20with.%26nbsp%3B%20It%20is%20presumed%20that%20a%20request%20is%20submitted%20to%20the%20service%20desk%20to%20create%20an%20external%20user%20with%20access%20to%20a%20particular%20sharepoint%20or%20other%20shared%20resource.%26nbsp%3B%20Guest%2FExternal%20user%20parameters%20should%20have%20already%20been%20configured%20in%20AAD%20(i.e.%20Terms%20of%20Use).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20service%20desk%20staff%20runs%20the%20script%2C%26nbsp%3Bwhich%20prompts%20for%20external%20user%20First%2FLast%20Names%20%26amp%3B%20email%20address%2C%20as%20well%20as%20the%20UPN%2FEmail%20of%20the%20requestor.%26nbsp%3B%20It%20sends%20a%20customized%20rich-text%20email%20invitation%20to%20the%20external%20user%20by%20importing%20a%20prepped%20HTML%20file%2C%20sets%20the%20External%20user%20Acct's%20'manager'%20field%20as%20the%20requester%20(for%20auditing%2Freporting)%20and%20notifies%20the%20original%20requester%20that%20the%20invitation%20has%20been%20sent.%26nbsp%3B%20Comments%20need%20to%20be%20improved%2C%20but%20look%20for%20the%20text%20in%20between%20the%20%26lt%3B%20%26amp%3B%20%26gt%3B%20values%20to%20see%20what%20you'll%20need%20to%20provide.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%23%20Collected%20parameters%2Fvariables%20passed%20in%20through%20script%20switches.%3CBR%20%2F%3EParam(%3CBR%20%2F%3E%5Bstring%5D%20%5BParameter(Mandatory%3D%24true)%5D%5BValidateNotNullOrEmpty()%5D%20%24ExUserEmail%3D%24(Throw%20%22Please%20provide%20the%20external%20user%20e-mail%20address.%22)%2C%3CBR%20%2F%3E%5Bstring%5D%20%5BParameter(Mandatory%3D%24true)%5D%5BValidateNotNullOrEmpty()%5D%20%24ExUserLastName%3D%24(Throw%20%22Please%20provide%20the%20external%20user's%20Last%20name.%22)%2C%3CBR%20%2F%3E%5Bstring%5D%20%5BParameter(Mandatory%3D%24true)%5D%5BValidateNotNullOrEmpty()%5D%20%24ExUserFirstName%3D%24(Throw%20%22Please%20provide%20the%20external%20user's%20First%20name.%22)%2C%3CBR%20%2F%3E%5Bstring%5D%20%5BParameter(Mandatory%3D%24true)%5D%5BValidateNotNullOrEmpty()%5D%20%24Manager%3D%24(Throw%20%22Please%20provide%20the%20e-mail%20address%20of%20the%20requestor.%22)%3CBR%20%2F%3E)%3C%2FP%3E%3CP%3E%24EmailBody%20%3D%20Get-Content%20%20-Raw%3C%2FP%3E%3CP%3E%23%20Connect%20to%20Azure%20AD%20using%20PW%20stored%20in%20encrypted%20txt%20file%20-%20Or%2C%20use%20your%20own%20credential%20meethod%3CBR%20%2F%3E%24TenantUname%20%3D%20%22%3CUSERID%3E%3CBR%20%2F%3E%24TenantPass%20%3D%20cat%20%22%3CPATH%20to%3D%22%22%20encrypted%3D%22%22%20pw%3D%22%22%20txt%3D%22%22%20file%3D%22%22%3E%3C%2FPATH%3E%24Credential%20%3D%20New-Object%20-TypeName%20System.Management.Automation.PSCredential%20-ArgumentList%20%24TenantUname%2C%20%24TenantPass%3CBR%20%2F%3E%23%24Credential.Password.Length%3CBR%20%2F%3E%24Credential.password.MakeReadOnly()%3CBR%20%2F%3EConnect-AzureAD%20-Credential%20%24Credential%3C%2FUSERID%3E%3C%2FP%3E%3CP%3E%23%20Send%20customized%20guest%20user%20email%20invite%3CBR%20%2F%3E%24messageInfo%20%3D%20New-Object%20Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo%3CBR%20%2F%3E%24messageInfo.customizedMessageBody%20%3D%20%22Please%20click%20on%20the%20'Get%20Started'%20link%20below%20to%20setup%20your%20Guest%20Account.%20This%20account%20can%20be%20used%20to%20login%20to%20SharePoint%20sites%20that%20a%20%3CCOMPANYNAME%3E%20employee%20gives%20you%20access%20to.%22%3CBR%20%2F%3ENew-AzureADMSInvitation%20-InvitedUserEmailAddress%20%24ExUserEmail%20-InvitedUserDisplayName%20%24ExUserLastName'%2C%20'%24ExUserFirstName%20-InviteRedirectUrl%20%3CSETUP%20in%3D%22%22%20aad%3D%22%22%3E%20-InvitedUserMessageInfo%20%24messageInfo%20-SendInvitationMessage%20%24true%3C%2FSETUP%3E%3C%2FCOMPANYNAME%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%23%20Set%20'Manager'%20field%20of%20guest%20user%20account%20to%20requester.%3CBR%20%2F%3E%24ExUserObjectId%20%3D%20(Get-AzureADUser%20-Filter%20%22Mail%20eq%20'%24ExUserEmail'%22).ObjectID%3CBR%20%2F%3E%24ManagerObjectId%20%3D%20(Get-AzureADUser%20-ObjectId%20%24Manager).ObjectId%3CBR%20%2F%3E%24ManagerEmail%20%3D%20(Get-AzureADUser%20-ObjectId%20%24Manager).Mail%3C%2FP%3E%3CP%3ESet-AzureADUserManager%20-ObjectID%20%24ExUserObjectId%20-RefObjectId%20%24ManagerObjectId%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%23%20Send%20Notification%2FConfirmation%20E-Mail%20To%20Requester%20Letting%20them%20know%20that%20invitation%20has%20been%20sent.%3CBR%20%2F%3E%23%24bodyText%20%3D%20%24body%20%7C%20convertTo-HTML%20%7C%20Out-String%3CBR%20%2F%3E%23Sending%20the%20email%20to%20the%20requestor%2Fmanager.%3CBR%20%2F%3ESend-MailMessage%20-From%20'%3CFROMADDRESS%3E%3C%2FFROMADDRESS%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-301084%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Ability%20to%20customize%20Guest%20invitation%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-301084%22%20slang%3D%22en-US%22%3EI'll%20give%20it%20a%20try%20to%20see%20how%20the%20emails%20turn%20out%2C%20tanx%20mate.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-300569%22%20slang%3D%22en-US%22%3ERE%3A%20Ability%20to%20customize%20Guest%20invitation%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-300569%22%20slang%3D%22en-US%22%3EIf%20you%20have%20access%20into%20AAD%20you%20can%20do%20so.%20May%20require%20P1%2C%20but%20you%20can%20also%20write%20a%20PS1%20that%20executes%20the%20'New-AzureADMSInvitation'%20CMD%20and%20you%20can%20do%20with%20it%20whatever%20you%20want.%3C%2FLINGO-BODY%3E
Contributor

Is there a way to customize guest invitation emails, as pr. now a lot of our clients/users sees the invitation as some kind of spam and ignore it. It will help if we can customize the invitasjon to include our branding and customized text..ect

4 Replies
If you have access into AAD you can do so. May require P1, but you can also write a PS1 that executes the 'New-AzureADMSInvitation' CMD and you can do with it whatever you want.
I'll give it a try to see how the emails turn out, tanx mate.

Here's what I came up with.  It is presumed that a request is submitted to the service desk to create an external user with access to a particular sharepoint or other shared resource.  Guest/External user parameters should have already been configured in AAD (i.e. Terms of Use). 

 

The service desk staff runs the script, which prompts for external user First/Last Names & email address, as well as the UPN/Email of the requestor.  It sends a customized rich-text email invitation to the external user by importing a prepped HTML file, sets the External user Acct's 'manager' field as the requester (for auditing/reporting) and notifies the original requester that the invitation has been sent.  Comments need to be improved, but look for the text in between the < & > values to see what you'll need to provide.


# Collected parameters/variables passed in through script switches.
Param(
[string] [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()] $ExUserEmail=$(Throw "Please provide the external user e-mail address."),
[string] [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()] $ExUserLastName=$(Throw "Please provide the external user's Last name."),
[string] [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()] $ExUserFirstName=$(Throw "Please provide the external user's First name."),
[string] [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()] $Manager=$(Throw "Please provide the e-mail address of the requestor.")
)

$EmailBody = Get-Content <HTML SOURCE FILE TO BE PLACED IN BODY OF EMAIL-Create Your Own Content> -Raw

# Connect to Azure AD using PW stored in encrypted txt file - Or, use your own credential meethod
$TenantUname = "<USERID@DOMAIN.COM">
$TenantPass = cat "<PATH TO ENCRYPTED PW TXT FILE" | ConvertTo-SecureString
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $TenantUname, $TenantPass
#$Credential.Password.Length
$Credential.password.MakeReadOnly()
Connect-AzureAD -Credential $Credential

# Send customized guest user email invite
$messageInfo = New-Object Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo
$messageInfo.customizedMessageBody = "Please click on the 'Get Started' link below to setup your Guest Account. This account can be used to login to SharePoint sites that a <COMPANYNAME> employee gives you access to."
New-AzureADMSInvitation -InvitedUserEmailAddress $ExUserEmail -InvitedUserDisplayName $ExUserLastName', '$ExUserFirstName -InviteRedirectUrl <SETUP IN AAD> -InvitedUserMessageInfo $messageInfo -SendInvitationMessage $true


# Set 'Manager' field of guest user account to requester.
$ExUserObjectId = (Get-AzureADUser -Filter "Mail eq '$ExUserEmail'").ObjectID
$ManagerObjectId = (Get-AzureADUser -ObjectId $Manager).ObjectId
$ManagerEmail = (Get-AzureADUser -ObjectId $Manager).Mail

Set-AzureADUserManager -ObjectID $ExUserObjectId -RefObjectId $ManagerObjectId


# Send Notification/Confirmation E-Mail To Requester Letting them know that invitation has been sent.
#$bodyText = $body | convertTo-HTML | Out-String
#Sending the email to the requestor/manager.
Send-MailMessage -From '<FROMADDRESS@DOMAIN.COM' -To "$ManagerEmail" -Subject "CONFIRMATION: The External User Account You Requested Has Been Created." -BodyAsHTML -body $EmailBody -smtpserver <SMTPRELAYServer.Domain.com>

best response confirmed by Jimmy Hang (Contributor)
Solution

Re-reading your request, my solution isn't quite what you're wanting, but I think if you specify something clear/obvious in the subject as well as the 'From' address it should get you where you need to be and minimize any spam/junk problems.  

Also, this is what gets sent to the users who request an external acct be created:

 

Greetings,

 

The Office 365 External User Account that you requested has been created, and an invitation has been sent to the email address you provided.

 

  • Once they have received the Invitation E-Mail, they must accept the invitation by clicking the 'Get Started' link in the e-mail.

 

  • You may wish to reach out to them personally to confirm they received and have accepted the invitation.

 

  • Further, you have been designated as the Manager for this account, and will be periodically contacted to see if the user still requires access.

 

  • If/When the user no longer requires access, please submit a service desk ticket to have the account removed.

 

  • You will receive a separate confirmation from the Remedy System when your incident/request ticket has been closed.

 

Please contact the Service Desk if you require assistance.

 

Do not reply to this email, as it was automatically generated and sent from an unmonitored address.

 

Thank you.

ITS