Search This Blog

Monday 19 August 2013

Add User’s Email Address to Their Profile via PowerShell

After deploying the SharePoint template for a client, I was doing some testing and noticed that the workflow failed because of an error. I checked the Workflow History and saw the following error message:
The e-mail message cannot be sent. Make sure the e-mail has a valid recipient


I searched around the SharePoint user interface and noticed the user that I had been testing the workflow with in fact did not have an email address. For some reason active directory (AD) did not pull the user’s email address into their user profile. I clicked on the edit profile link in SharePoint to try to edit their profile, but of course I wasn’t able to add/edit the email address.
I came to the conclusion that the only way I could add the user’s missing email address was via PowerShell. Here is the code that I used:
Set-SPUser -Identity "DOMAINusername" -Email "email@yourdomain.com"
-Web http://yourdomain.com


After adding the user’s email address to their user profile, I no longer received an error on the workflow. The issue was fixed!

No comments:

Post a Comment