Retrive User profile propertes using javascript rest api in sharepoint online

Mahesh C M 136 Reputation points
2021-03-10T14:13:06.413+00:00

Hi Guys,

I have a sharepoint hosted app. In the application i have facing an issue in retrieving user profile properties using rest api call in javascript. Got an unauthorized exception while accessing the api. try to resolve this issue by provide a tenant read permission to application and then deploy the application , there is a deploy request has been send to the tenant admin , i have the tenant admin access and i approved the deployment request but nothing happens. Could anyone help me what is the best method to get the user profile from sharepoint online.

I have tried javascript object model to retrieve the user data. there also i got the same issue .(below given the link)

https://learn.microsoft.com/en-us/sharepoint/dev/general-development/how-to-retrieve-user-profile-properties-by-using-the-javascript-object-model-in#bk_CreateAppPage

Microsoft 365 Publishing
Microsoft 365 Publishing
Microsoft 365: Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line. Publishing: The process of preparing, producing, and releasing content for distribution or sale.
491 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
6,055 questions
{count} votes

Accepted answer
  1. Jerryzy 10,301 Reputation points
    2021-03-11T02:59:22.39+00:00

    Hi @MaeshCM-7927,

    You can use Rest API to get user Profile Propeties in SharePoint Hosted app like this:

    76518-snipaste-2021-03-11-10-45-58.png

    76487-getuserprofile.txt

    App Permision:

    76499-snipaste-2021-03-11-10-51-59.png

    While deploying, directly clicking the Trust:

    76460-snipaste-2021-03-11-10-58-54.png

    76488-snipaste-2021-03-11-10-45-06.png

    Thanks
    Best Regards


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments

0 additional answers

Sort by: Most helpful