I have hit a bit of a roadblock in some recent work, and I'm not sure how to proceed.

Goal: be able to access a user's first and last name in JavaScript running in a SharePoint 2013 page, through the client-side object model. The first and last name are available in ADFS claim information.

What I've done so far:

  1. Set up ADFS integration - users can sign in to SharePoint 2013 with their ADFS credentials through the ADFS sign-in site.

  2. Taught the STS about the attributes

  3. Added the mappings to the token issuer

PowerShell pieces for 2 and 3:

$sts = Get-SPTrustedIdentityTokenIssuer

$map1 = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" -IncomingClaimTypeDisplayName "Given Name" -SameAsIncoming
$map2 = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" -IncomingClaimTypeDisplayName "Surname" -SameAsIncoming
Add-SPClaimTypeMapping -TrustedIdentityTokenIssuer $sp -AssignmentCollection $map1
Add-SPClaimTypeMapping -TrustedIdentityTokenIssuer $sp -AssignmentCollection $map2

When I try to access the profile manager in script, I get Unknown error:

context = new SP.ClientContext.get_current();
peopleManager = new SP.UserProfiles.PeopleManager(context);
userProfileProperties = peopleManager.getMyProperties();
context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);

So my question has two parts:

  1. I think I have to do something in the profile service to make the new properties available, but I'm not clear what

  2. Once the properties are in SharePoint, how do I get them out properly in script?

EDIT: at the moment, the user's e-mail address is the only identifier visible in SharePoint (e. g. in the upper right). We don't have access to the remote AD so we can't do a profile import to pick up other properties through that route.

  • Does the username or actual name appear at the top of the sharepoint page already? If your authentication is already working correctly you can get user properties like first and last name quite easily using functions built into the JSOM and not worry about interacting directly with ADFS at all. – John-M Jun 16 '15 at 22:42

Your Answer

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

Browse other questions tagged or ask your own question.