0

I have created some user profiles in my AD environment and its available in my SharePoint and added them as my portal visitors group and they dont have email enabled.

Now because of my other workflow requirements and needed to get the emails triggered from workflows,I changed the email property in my AD environment with proper Mail IDs.

Now when i implemented my solutions involving workflows and emails triggers , am not able to get the emails targetted to these users.

What should I do in my user profile serv application in order to get the proper emails for these newly created users?

Unfortunately, i can not perform sync operation of the UPSA. is there any way, i can update the email property of these users with proper mail ids.

1

You use the below power shell to update the user profile email.

#First load the SharePoint commands 
add-PSSnapIn Microsoft.SharePoint.PowerShell

#Set up the job variables 
$csvfile="C:\\UsersEmail.csv"  # this csv excel should have "ADAccout","Email" column with user data 
$mySiteUrl = "http://mysite" 
$upAttribute = "WorkEmail" # this is the user profile email property

 #Connect to User Profile Manager service 
$site = Get-SPSite $mySiteUrl 
$context = Get-SPServiceContext $site 
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) 

#Create Lists from each item in CSV file 
$csvData = Import-Csv $csvfile 

#Now iterate through the list to update the attribute with new value 
foreach ($line in $csvData)
{ 
#Check to see if user profile exists 
if ($profileManager.UserExists($line.ADAccout)) 
    { 
        #Get user profile and change the value 
        $up = $profileManager.GetUserProfile($line.ADAccout) 
        $up[$upAttribute].Value = $line.Email
        $up.Commit() 
    } 
   else 
   { 
    write-host "Profile for user"$line.ADAccout "cannot be found" 
   } 
} 

#Dispose of site object 
$site.Dispose()
  • Suresh, I will check the code and try to execute in my environment , and update here! – SaMolPP Mar 23 '17 at 11:50
  • 1
    Okay..! Please prepare the excel sheet and save that excel in csv format and check the file path location in the power shell I gave C drive you change it as your convenient – Suresh Bolineni Mar 23 '17 at 11:58
0

Each Site Collection saves on first entry the profile from users. Sync only with ups ootb possible. UPS quick sync to sharepoint job will update each collectio with changed profile from ups.

0

You may take following steps:

  1. As there are only 2 accounts, you may modify them directly in User Profile Service Application manually by following path: Application Management > Manage Service Applications > User Profile Service (Application) > Manage User Profiles > Find profile > Click on account name > Edit My profile > Save.

  2. Run "User Profile to SharePoint Full Synchronization" job

  3. If it is still not working after step 2, then since you may have already used these accounts to access application. Run script to sync user changes to site collection user information table. (Article here)

function Sync-SPUser([string]$userName, [string]$email) {

Get-SPSite -Limit All | $web = $_.RootWeb
if ($_.WebApplication.UseClaimsAuthentication) {
  $claim = New-SPClaimsPrincipal $userName -IdentityType WindowsSamAccountName
  $user = $web | Get-SPUser -Identity $claim -ErrorAction SilentlyContinue
} else {
  $user = $web | Get-SPUser -Identity $userName -ErrorAction SilentlyContinue
}
if ($user -ne $null) {
  $web | Set-SPUser -Identity $user -SyncFromAD

  $list = $web.Lists["User Information List"]
  $query = New-Object Microsoft.SharePoint.SPQuery
  $query.Query = "<Where><Eq><FieldRef Name='Name' /><Value Type='Text'>$userName</Value></Eq></Where>"
  foreach ($item in $list.GetItems($query)) {
    $item["Email"] = $email
    $item.SystemUpdate()
  }
}
$web.Dispose()
$_.Dispose()

} }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.