Solution Explorer, right-click on the "References" folder and then click on "Add Reference"
We have to add ddl:
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
Microsoft.SharePoint.Client.UserProfiles.dll
Namespace:
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.UserProfiles;
Coding:
string siteUserName="nam";
string _siteurl="http://sharepoint.com";
string _sitepassword ="pass@word1";
string accountName ="raghupc\raghu";
ClientContext clientContext = new ClientContext(_siteurl);
clientContext.AuthenticationMode =ClientAuthenticationMode.Default;
clientContext.Credentials = new System.Net.NetworkCredential(_siteUserName, _sitepassword, _domainName);
Web oweb = clientContext.Web;
clientContext.ExecuteQuery();
PeopleManager peopleMang = new PeopleManager(clientContext);
PersonProperties personProp = peopleMang.GetPropertiesFor(accountName);
clientContext.Load(personProp, p => p.AccountName, p => p.Email, p => p.DisplayName);
clientContext.ExecuteQuery();
Label1.Text= personProp.AccountName;
Label2.Text= personProp.Email;
Label3.Text =personProp.DisplayName;
We have to add ddl:
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
Microsoft.SharePoint.Client.UserProfiles.dll
Namespace:
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.UserProfiles;
Coding:
string siteUserName="nam";
string _siteurl="http://sharepoint.com";
string _sitepassword ="pass@word1";
string accountName ="raghupc\raghu";
ClientContext clientContext = new ClientContext(_siteurl);
clientContext.AuthenticationMode =ClientAuthenticationMode.Default;
clientContext.Credentials = new System.Net.NetworkCredential(_siteUserName, _sitepassword, _domainName);
Web oweb = clientContext.Web;
clientContext.ExecuteQuery();
PeopleManager peopleMang = new PeopleManager(clientContext);
PersonProperties personProp = peopleMang.GetPropertiesFor(accountName);
clientContext.Load(personProp, p => p.AccountName, p => p.Email, p => p.DisplayName);
clientContext.ExecuteQuery();
Label1.Text= personProp.AccountName;
Label2.Text= personProp.Email;
Label3.Text =personProp.DisplayName;
No comments:
Post a Comment