1

I am looking for a way to the retrieve the following information for a user

https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.userprofiles.personproperties.aspx

Especially

https://msdn.microsoft.com/EN-US/library/office/microsoft.office.server.userprofiles.personproperties.personalurl.aspx

through the REST API for Sharepoint Online (Office 365 subscription).

Can I get this info through the APIs? I am polling users through Graph API and I need this information against the users I get (but since Azure doesn't provide this, I am stuck)

I am aware of the User Profile API

https://msdn.microsoft.com/en-us/library/office/dn790354.aspx#bk_PeopleManagerGetPropertiesFor

The mentioned in the docs is an unknown in my case. I can't use the discovery service as well.

My understanding is that I could just use

https://<tenantName>-my.sharepoint.com 

as a host (site URL) to use the User Profile API endpoints. Is this correct?

PS: We are using Client Credentials Flow to obtain the access token (i.e, no user context associated with the token) Moreover, I have gone through CSOM and Powershell options, so I am aware of those. I am interested in the API endpoints.

1 Answer 1

3

You can use this REST endpoint:

https://<server>/_api/sp.userprofiles.peoplemanager/getPropertiesFor(@v)?@v='domain\LoginName'

This retrieves all profile information for the given LoginName. You can select the property PersonalUrl by adding $select = PersonalUrl

For more information see the User profiles REST API reference at MSDN.

4
  • Thanks. But I need to get this <serverURL> you have mentioned, the problem is that I fetch users through Azure AD(Graph) and there is no field that tells me the OneDrive Url for a user. So, I need to find out an API endpoint which could tell me that, i.e, for a user I need to know the personal site URL. Commented Jan 4, 2016 at 15:49
  • Wouldn't the discovery endpoint get you that, then in turn be able to use the above? Commented Jan 4, 2016 at 15:59
  • Try the following using the graph API: graph.windows.net/graphdir1.onmicrosoft.com/tenantDetails you can test this url here: graphexplorer2.cloudapp.net/Home/Index/DemoCompany
    – must19
    Commented Jan 4, 2016 at 16:31
  • The Site URL is an unknown in my case and I can't use the Discovery service either. Can I just use https://<tenantName>-my.sharepoint.com? Commented Jan 5, 2016 at 18:26

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.