Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Custom Membership Provider - name passed in as email to custom function

$
0
0

Hi all,

I created a custom membership provider for SharePoint 2013. I have successfully logged in using the provider and the users from my custom provider are returned in people pickers.

I ran into problems when I chose the custom users from the picker. I would get errors that the user is not found. I narrowed the issue down to SharePoint calling the following function.

 public override string GetUserNameByEmail(string email).

The email string passed in is equal to the username. For example email = "John Doe" instead of j.doe@company.com.

In my custom membership provider I have a function that maps my custom user to a MemebershipUser to return in all functions that return Memebership users.

 MembershipUser u = new MembershipUser(this.Name,
                                     user.FirstName + " " + user.LastName,
                                     user.UserID,
                                     user.EmailAddress,
                                     "",
                                     "",
                                     true,
                                     false,
                                     user.CreateDate,
                                     user.LastLoginDate ?? DateTime.Now,
                                     user.LastLoginDate ?? DateTime.Now,
                                     DateTime.Today,
                                     DateTime.Today);

In the people pickers I can clearly see the email address is set to j.doe@company.com and name is set to "John Doe" so the fields are mapped properly. If I change the above mapping to set the second parameter to user.EmailAddress the pickers work but then all users are just email addresses and have no display names. Anyone have any idea as to why SharePoint is passing the name parameter to the GetUserNameByEmail function.

Thanks in advance!


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>