Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. SPSecurity.RunWithElevatedPrivileges(delegate()
  2. {
  3. string siteUrl = SPContext.Current.Web.Url;
  4.  
  5. using (SPSite siteCollection = new SPSite(siteUrl))
  6. {
  7.  
  8. SPServiceContext serviceContext = SPServiceContext.GetContext(siteCollection);
  9. UserProfileManager userProfileMgr = new UserProfileManager(serviceContext);
  10. UserProfile userProfile = userProfileMgr.GetUserProfile(true);
  11. try
  12. {
  13. userProfile["SkypeAccount"].Value = "test";
  14. userProfile.Commit();
  15. }
  16. catch { }
  17.  
  18.  
  19. try
  20. {
  21. userProfile["WorkPhone"].Value = "12345678";
  22. userProfile.Commit();
  23. }
  24. catch { }
  25. }
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement