2

I'm looking for some help with a REST call I'm attempting to make in SharePoint Online.

I'm doing an add-in that gives me the name, birhday and photo property of all user in user profiles

enter image description here

I tried with this code

 var siteUrl = _spPageContextInfo.siteAbsoluteUrl;
    Console.log(siteUrl);
    $.ajax({
        url: siteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            console.log(data);
        },
        error: function(error) {
            console.log(error);
        }
    });

but I only get current user profile properties, what I need is all user profiles properties for all users, how can i achieve that?

Thanks in advance!

8

Still this no API for retrieving all user profiles from SharePoint Online

You can get current user's profile

_api/SP.UserProfiles.PeopleManager/GetMyProperties

Or a particular user's profile by login name

/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|xx@siteurl.onmicrosoft.com'

BUT You can get available user profiles in a site

/_vti_bin/ListData.svc/UserInformationList
  • How about SP.UserProfiles.js? Yes I know OP specifically say REST, but this should actually work, also for apps (which is not so easy with _vti_bin). – eirikb May 25 '16 at 18:00
  • 1
    It is used to get the user's information from SharePoint's default (hidden) list called UserInforamtion. – Hardik May 25 '16 at 19:30
  • 1
    I gave this as another option but you need users from tanent & it is not possible to get all user's all information from tanent using REST. :) – Hardik May 25 '16 at 19:31
  • 1
    Unfortunately there is no option for SharePoint Online. – Hardik May 25 '16 at 20:13
  • 1
    @Hardik We have the birthday but when I get the User Information List fron this link SiteURL/_vti_bin/listdata.svc/UserInformationList the Birthday is null <d:DateOfBirth m:type="Edm.DateTime" m:null="true" /> – Sebastián A May 25 '16 at 22:11
1

you can use SPFx People Picker (version 11+) which was released recently at https://sharepoint.github.io/sp-dev-fx-controls-react/controls/PeoplePicker/ .

Basically, this control will allow you to pick any users in all trusted domains in SharePoint Online.

0

URL:

http://SiteURL/_api/Web/lists/getbytitle('User Information List')/Items

Headers:

Accept: application/json; odata=verbose
Content-Type: application/json; odata=verbose

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.