Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am replacing a colleage for support of a SharePoint 2010 intranet.
A functionality has been implemented in a site allowing users to make holiday requests.
A user must fill in an InfoPath form to make an holiday request.
A record is added to a library when an holiday request is made.

The GetUserProfileByName method of the UserProfileService web service is called when the InfoPath form is loading.
GetUserProfileByName is called to get user's information including the account name.
The account name is stored in a column of the record corresponding to the holiday request.

I have looked at records and I have noticed an issue.
I prefer to explain the issue with an example for the sake of clarity.

Let's consider the user Taylor Gordon.
His account name is MYDOMAIN\GordonT as dislayed in the intranet.

He made a first holiday request on the 8th of April 2013.
The GetUserProfileByName retrieved the account name MYDOMAIN\GordonT.
There is no character case difference with the intranet account name.

He made a second holiday request on the 19th of April 2013.
The GetUserProfileByName retrieved the account name MYDOMAIN\gordont.
The user name is surprisingly in lower case and it is an issue.

I guess the GetUserProfileByName method reads a user account data source different from the one read by the intranet.
Am I right ?
If so then how can I synchronize the two datasources.

For information the users of the intranet have been imported from an active directory by a User Profile Service.

Any help will be greatly appreciated

share|improve this question

1 Answer 1

This is not an uncommon problem in SharePoint but there are workarounds available. You could make all cases in lowercase and you'll get a match even when there's a case difference. In InfoPath you would do the following to translate all upper cases to lower cases:

translate(userNameField, "ABCDEFGHIJKLMNOPQRSTUVWYXZ", "abcdefghijklmnopqrstuvwyxz")

The translate function in InfoPath will result in mydomain\gordont.

Do the same when you retrieve your user from code behind:

// the user profile username as string in the variable userName
userName.ToLowerInvariant();

This also sets the username to all lower cases and you'll get a match in mydomain\gordont.


References:

Converting letters to lower case in InfoPath

String.ToLowerInvariant Method

Alternative for using Roles in InfoPath Browser based forms

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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