SharePoint 2013 USERPROFILE user information

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.