How to get UserID based on old email, if user changes his email

Copper Contributor

Hello guys,

                  I have a situation to get userid based on email address. I have a user email address which was already stored. Now the user changed his email address. By sending the old email address how to get the userid or can i get the new email address of the user by sending old email address.

code which i used:


var customerid_d = $.Deferred();
var prefix = "i:0#.f|membership|";
var Email = prefix + Email;
var customerid_url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/siteusers(@v)?@v='" + encodeURIComponent(Email) + "'";
getData(customerid_url, customerid_d, false).done(function(data) {
    var result = data.d;
    if (result != undefined && result != "" && result != null) {
        id = result.Id;

function getData(url, d, async) {
        url: url,
        method: "GET",
        async: async,
        headers: {
            "Accept": "application/json; odata=verbose"
        success: function(data) {
        error: OnError
    return d.promise();

Please help me to find a solution for this. Thank you. 

0 Replies