How to use SharePoint Client Object Model to get User Information by User Lookup ID

Referred URL - http://melick-rajee.blogspot.sg/2011/08/how-to-use-sharepoint-client-object.html


protected string getUserEmail(int lookupid)
{
    String Useremail = string.Empty; 
 
    try
    {
        using (ClientContext clientContext = new ClientContext(siteUrl))
        {
            Microsoft.SharePoint.Client.ListItem userInfo = clientContext.Web.SiteUserInfoList.GetItemById(lookupid);
            clientContext.Load(userInfo);
            clientContext.ExecuteQuery();
            Useremail = userInfo["EMail"].ToString();
        } 
 
    }
    catch (Exception ex)
    {
        // TODO: // handle the error             
    } 
 
    return Useremail;
}

You May Also Like

0 comments