Remove associated email from user

  • 1
  • Problem
  • Updated 1 year ago

I'm trying to remove/unassociate an email from a user, by updating the user and setting the "Emails" to only contain the one correct email address for the user, rather than two (one correct and one old/incorrect).

I can see the two emails using the following:

Send-SfRequest -Client $Client -Method GET -Uri "https://$($ApiHost)/sf/v3/Users($($UserId))" | Select-Object -Property Emails



I attempted to remove the incorrect email by using the following:

$UpdDetails = @{
    'Emails' = @(
Send-SfRequest -Client $Client -Method PATCH -Uri "https://$($ApiHost)/sf/v3/Users($($UserId))" -BodyText $($UpdDetails | ConvertTo-Json)


Send-SfRequest : NotFound: Email: You cannot add this email address because it is already associated with you.
+ Send-SfRequest -Client $Client -Method PATCH -Uri "$($ApiHost ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Send-SfRequest], Exception
    + FullyQualifiedErrorId : NotFound,ShareFile.Api.Powershell.SendSfRequest

How do I remove the associated email that is incorrect?


The correct and incorrect email is usually a new client email address and an old (SSO) employee email address. Because the user is no longer an employee, the SSO login is automatically disabled, which in turn downgrades the user to a client (as they should be). But they are then experiencing problems logging in, because ShareFile can't seem to handle a scenario like this. Other employees cannot share content with them because they somehow don't properly exist in the Web UI, even though they exist when looking through API. Attempting to create the user as a client ofcourse fails, because the email address that is attempting to be created already exists in the system. Deleting the account and re-inviting the user again, as a client, resolves the issue but adds the unnecessary overhead of re-adding that user to the various folders they had access to prior to being deleted.

Photo of briped


  • 10 Posts
  • 0 Reply Likes

Posted 1 year ago

  • 1
Photo of Michael Berrier

Michael Berrier, Software Engineer

  • 123 Posts
  • 24 Reply Likes

Sorry for the delayed reply. You should be able to delete the email address for a user by using the Delete Email Address endpoint:


See the Users API documentation for detail:

Note that you can't delete the primary email address for a user, so if the problematic email is currently the primary, you will have to make an additional call first to set a different primary. E.g.,


Michael Berrier
ShareFile Engineering