Hy.
I have Requirement to Create WebPart that get Data from USer Profile of Current User in Office 365(SharePoint Online-SandBox).
is that Possible with SandBox Solution?
Thanks in Advance.
You can add a Script Editor Webpart and use the rest api to get the user profile details.
Below is a snippet which show you to get an instance of people manager using rest api
$.ajax({ url: "http://<site url>/_api/sp.userprofiles.peoplemanager", type: "GET",headers: { "accept": "application/json;odata=verbose" }, success: successHandler, error: errorHandler});
On Success you can write your logic how you wanted to use the User profile data.
You can also create a sandbox Webpart and use the below code. Add the user profile dll and using Microsoft.SharePoint.Client.UserProfiles; in your code
const string serverUrl = "http://serverName/";
const string targetUser = "domainName\\userName";
// Connect to the client context.
ClientContext clientContext = new ClientContext(serverUrl);
// Get the PeopleManager object and then get the target user's properties.
PeopleManager peopleManager = new PeopleManager(clientContext);
PersonProperties personProperties = peopleManager.GetPropertiesFor(targetUser);
// Load the request and run it on the server.
// This example requests only the AccountName and UserProfileProperties
// properties of the personProperties object.
clientContext.Load(personProperties, p => p.AccountName, p => p.UserProfileProperties);
clientContext.ExecuteQuery();
foreach (var property in personProperties.UserProfileProperties)
{
Console.WriteLine(string.Format("{0}: {1}",
property.Key.ToString(), property.Value.ToString()));
}
Console.ReadKey(false);