I am looking for a way how to find some users emaill address based on their domain id. I found many solutions for Current users via

user = clientContext.get_web().get_currentUser();

however i want to find info about different user. I was trying to google for some time but did not find solution. Is there some way to retrieve users email for example with similar method?

Something like this

user = clientContext.get_web().getinfo(SPECIFIC USER DOMAIN NAME)

Thanks so much.

2 Answers 2


The following example code for your reference, modify the "loginName" in the code and add the code into a script editor web part in page.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
    var loginName="domain\\username";
function getUserEmailByLoginName(loginName) {
    var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/siteusers?$select=Email&$filter=substringof('"+loginName+"',LoginName)";                  
    //execute AJAX request
        url: requestUri,
        type: "GET",
        headers: { "ACCEPT": "application/json;odata=verbose" },
        success: function (data) {

        error: function () {
            //alert("Failed to get details");                
  • Thank you very much exactly what i was looking for. For anyone interested here is the link also with other attributes that can be retrieved. sharepoint.stackexchange.com/a/171290/82539
    – Rudolf
    Commented Apr 8, 2019 at 6:42
  • I came to a problem that this connects to siteusers list. Is there a way how to connect to whole active directory domain where the users are? because like this i cannot find many users, only ones that have access to sharepoint or are part of siteusers list from past. Thanks.
    – Rudolf
    Commented Apr 15, 2019 at 14:36
  • If you want to get all users, you need remove the filter in the rest api, like /_api/web/siteusers
    – LZ_MSFT
    Commented Apr 16, 2019 at 1:22

Try to use this REST API endpoint to have all users information:


then filter by the field you know and select the information you need ($select=EMail)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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