8/17/2011

PowerShell to the Rescue… SharePoint User has no EMail address

 

I’m working with a SharePoint farm where the AD synchronization is not working, and we had a user who for some strange reason did not have an email address in SharePoint and could not get alerts. So while we are working out the AD problem, here’s how I quickly added an email address for this user:

$user = Get-SPUser  domain\username -web http://yourserver/sites/yoursitecollection

`check to see if they have an email address
$user.Email

`set an email address
$user.Email = "user@domain.com"
$user.Update()

Simple… and quick. But you will need to do this for each site collection the user has access to.

 

More on Get-SPUser:  http://technet.microsoft.com/en-us/library/ff607580.aspx

More on the SPUser object that’s returned by Get-SPUser: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spuser.aspx

.More on all of the properties and members of SPUser: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spuser_members.aspx

 

 

.

2 comments:

Anonymous said...

Thanks, Mike. This really came in handy as we are dealing with some AD issues as well.

Lynn

Unknown said...

Short and sweet and to the point. Thank you!

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.