I need to store all the properties for all the users in an array. How can I achieve this, with the executequeryasync method inside my foreach loop?
var profileProperties = [];
$(userProfilesArr).each(function(index, userAccount){
loadUserProfileProperties(userAccount)
})
console.log(userProfilePropArray);
function loadUserProfileProp(userAccount){
var userProfileProperty = new SP.UserProfiles.UserProfilePropertiesForUser(ctx, userAccount, ["property1","property2"]);
userProfileProperty = new SP.UserProfiles.PeopleManager(ctx).getUserProfilePropertiesFor(userProfileProperty);
ctx.load(userProfileProperty);
ctx.executeQueryAsync(function(){
//profileProperties.push...
})
}