Sharepoint2013 get the current user userfrofile introduction:
What enables user configuration files, user attributes, and user configuration file attributes to provide information about SharePoint users, such as display names, emails, titles, and other business and personal information. Developers can obtain the file, modify the file, and create the file. Sharepoint2013 is indeed a well-developed tool. You can use the JavaScript Object Model,. Net client object model, and service-end object model. Here we use the Server Object Model.
Implementation:
Get the current user:
Stringloginname = system. Web. httpcontext. Current. User. Identity. Name. tostring ();
For more information:
Spsecurity. runwithelevatedprivileges (delegate {spsite _ site = spcontext. current. site; spservicecontext servercontext = spservicecontext. getcontext (_ site); userprofilemanager myuserprofile = newuserprofilemanager (servercontext); USERPROFILE currentuserprofile = myuserprofile. getuserprofile (spcontext. current. web. currentuser. loginname); string departmentname = (string) currentuserprofile ["department"]. value; // Department string phonensumber = (string) currentuserprofile ["workphone"]. value; // telephone number string emailaddress = (string) currentuserprofile ["workemail"]. value; // email address })
Summary
This is an introduction. If you want to learn more, here is the msdv address:
Http://msdn.microsoft.com/ZH-CN/library/office/jj163182 (V = Office.15). aspx
SharePoint 2013 USERPROFILE user information