SharePoint-2013-RESET-API-1

SharePoint 2013 Hosting – HostForLIFE.eu :: How to Get Current Logged in User and Display Name using SharePoint 2013 REST API.

REST API is quite simple and straightforward, used User ID to get user Title, Email for SharePoint 2013 and apps for SharePoint. use  /_api/web/getuserbyid(ID) to get the user field  in the response data, we have an “AuthorId” will get us the user Title, Email etc. In this post, I’m gonna tell you how to get current logged in user and display name using SharePoint 2013 REST API.

SharePoint-2013-Hosting

Follow these steps to get current logged in user and display name using SharePoint 2013 REST API:

Step 1

Navigate to your SharePoint 2013 site and create a Wiki Page or a Web Parts page.

Step 2

Next, add your JavaScript code is quite straightforward:
Edit the page, go to the “Insert” tab in the Ribbon and click the “Web Part” option. In the “Web Parts” picker area, go to the “Media and Content” category, select the “Script Editor” Web Part and press the “Add button”.

Step 3

Once the Web Part is inserted into the page, you will see an “EDIT SNIPPET” link click. You can insert this HTML and/or JavaScript code into the dialog:

 SharePoint-2013-RESET-API-1

In the code above, you’ll get the author id from the list. By passing the author id in to GetUserBuId() method, it will return the user in raw format like “I:O#.f|xxxx|[email protected]”. Then, you can get the log in name by splitting the output.

SharePoint-2013-RESET-API-2SharePoint 2013 Hosting Recommendation

HostForLIFE.eu’s SharePoint 2013 Hosting solution offers a comprehensive feature set that is easy-to-use for new users, yet powerful enough for the most demanding web developer expert. Hosted SharePoint Foundation 2013 is the premiere web-based collaboration and productivity enhancement tool on the market today. With SharePoint 2013 Foundation, you can quickly access and manage documents and information anytime, anywhere though a Web browser in a secure and user friendly way. SharePoint hosting services start at only at €9.99/mo, allowing you to take advantage of the robust feature set for a small business price. HostForLIFE.eu offers a variety of hosted SharePoint Foundation 2013 plans as well as dedicated SharePoint 2013 Foundation options.

hostforlife banner