Guest User

Untitled

a guest
Nov 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public static UserProfile EnsureUserProfile(SPSite elevatedSite, string userLoginName)
  2. {
  3. var context = SPServiceContext.GetContext(elevatedSite);
  4. var profileManager = new UserProfileManager(context);
  5.  
  6. var userProfile = SearchByLoginName(elevatedSite, userLoginName);
  7.  
  8. if (!profileManager.UserExists(userLoginName))
  9. {
  10. userProfile = profileManager.CreateUserProfile(userLoginName);
  11. }
  12.  
  13. return userProfile;
  14. }
Add Comment
Please, Sign In to add comment