Вопрос

This code retrieves my property values succesfully except my "PersonalUrl" property. If i cant retrieve it with the PeopleManager object, is their any other options to retrieve the personal url property?

 var profilePropertyNames = ["SPS-HireDate", "PreferredName", "PictureURL", "PersonalUrl", "WorkEmail"];
                var userProfilePropertiesForUser = new SP.UserProfiles.UserProfilePropertiesForUser(ctx, userAccount, profilePropertyNames);
                var userProfileProperties = new SP.UserProfiles.PeopleManager(ctx).getUserProfilePropertiesFor(userProfilePropertiesForUser);
                ctx.load(userProfilePropertiesForUser);
                ctx.executeQueryAsync(function() {
                  userProfileProperties[0 1 3 ... etc]..
                });
Это было полезно?

Решение

You have to use getPropertiesFor

var profilePropertyNames = ["SPS-HireDate", "PreferredName", "PictureURL", "WorkEmail"];
var userProfilePropertiesForUser = new SP.UserProfiles.UserProfilePropertiesForUser(ctx, userAccount, profilePropertyNames);
var userProfileProperties = new SP.UserProfiles.PeopleManager(ctx).getUserProfilePropertiesFor(userProfilePropertiesForUser);

var personProperties =  new SP.UserProfiles.PeopleManager(ctx).getPropertiesFor(userAccount);
ctx.load(personProperties,'PersonalUrl');

ctx.load(userProfilePropertiesForUser);
ctx.executeQueryAsync(function() {

    var mySiteUrl = personProperties.get_personalUrl();

  userProfileProperties[0 1 3 ... etc]..
});

Take a look the SP.UserProfiles.PersonProperties object for available properties.

Другие советы

In my user profile the field name looks to be "PersonalSpace" not "PersonalUrl". Maybe try that? enter image description here

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top