Click here to Skip to main content
15,395,950 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all
i need to get the current user logged into office 365 instead of using it as static in my code

C#
SecureString password = new SecureString();
foreach (char c in "eman".ToCharArray()) password.AppendChar(c);
clientContext.Credentials = new SharePointOnlineCredentials("e@eman.onmicrosoft.com", password);
Posted
Updated 1-Jun-14 11:03am
v2

1 solution

var theData = {
"propertiesForUser": {
"__metadata": { "type": "SP.UserProfiles.UserProfilePropertiesForUser" },
"accountName" : "i : 0#.f|membership|mgangwar@server32.onmicrosoft.com",
"propertyNames": ["Email", "Phone"]
}
};

var requestHeaders = {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
};

jQuery.ajax({
url:_spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertiesFor",
type:"POST",
data: JSON.stringify(theData),
contentType : "application/json;odata=verbose",
headers: requestHeaders,
success:function(data){
console.log(data);
},
error:function(jqxr,errorCode,errorThrown){
console.log(jqxr.responseText);
}
});
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900