I need code to get user profile properties by using JavaScript or JQuery

 var url = appweburl +"/_api/SP.UserProfiles.PeopleManager/GetMyProperties";
 var requestHeaders = {
           "Accept": "application/json;odata=verbose"

 var executor = new SP.RequestExecutor(appweburl);
                url: url,
                contentType: "application/json;odata=verbose",
                method: "GET",
                headers: requestHeaders,
                success: function (data) {

                     var parsedData = JSON.parse(data.body);
                   alert(parsedData )

                error: function (data) {

the above code always throw error "Access denied,You do not have permission to perform this action or access this resource". I am working on SharePoint office 365,any method using JavaScript or jquery is acceptable.

  • are you using sharepoint hosted app or provider hosted app ? May 2, 2017 at 8:03

2 Answers 2


It seems that you are working on SharePoint Hosted App.

So, your app must be permitted to access the user profile.

So follow this steps:

  • Go to AppManifest.xml
  • Add following code in AppManifest.xml
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl"/>

This solved my problem in past.


Its not clear your what is your request Origin URL and Destination URL. If you are requesting from http://a/ and destination is http://b/ then CORS check may be fiered and throwing "Access Denied". Else following code must work;

  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler

Ref - MSDN-PeopleManagerGetMyProperties

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.