Pnpjs: InBatch function to get multiple UserProfile details

Created on 25 Nov 2019  路  3Comments  路  Source: pnp/pnpjs

I wonder whether I can batch the filter queries to get multiple user profile details, currently, I don't find InBatch function available for @pnp/sp/profiles

Category

  • [ ] Enhancement
  • [ ] Bug
  • [ *] Question
  • [ ] Documentation gap/issue

Most helpful comment

I'd suggest getting all profiles with search API instead.

All 3 comments

currently, I am using the below method to get the user profile details. How do i convert this to a batch so that I can reduce the roundtrip to the server.

Currently, I suppose to fetch 1500 user profile details and now I am going in a loop to get details and it is taking minutes to finish it.

  .profiles
  .getPropertiesFor(loginName).then((profile: any) => {

    console.log(profile.DisplayName);
    console.log(profile.Email);
    console.log(profile.Title);
    console.log(profile.UserProfileProperties.length);

    // Properties are stored in inconvenient Key/Value pairs,
    // so parse into an object called userProperties
    var properties = {};
    profile.UserProfileProperties.forEach(function(prop) {
    properties[prop.Key] = prop.Value;
    });
    profile.userProperties = properties;

}

I'd suggest getting all profiles with search API instead.

Hi @nsksaisaravana - it looks like this is answered. Moving forward the Microsoft Tech Community might be a more appropriate "How do I" type questions that are not directly related to this library. Thanks!

Was this page helpful?
0 / 5 - 0 ratings