If you like to show the current logged-in User in a Page or a Form (eg. NewForm.aspx), you can use following JavaScript code. Insert it via script editor/code snippet and don't forget to reference a Javascript file (<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>).
With that code, you can insert the Username into a div with the ID "welcome" (choose any ID you want, just change it in the script).
I used that code for a NewForm.aspx, the goal was to display the current User on top of the form. So I added folllowing HTML after the javascript code:
The result will be something like this - just edit the html accordingly:
Monday, October 9, 2017
Home
JavaScript
SharePoint
SharePoint 2013
Tipps & Tricks
Display current logged in User in a SharePoint Page or Form
Display current logged in User in a SharePoint Page or Form
Tags
# JavaScript
# SharePoint
# SharePoint 2013
# Tipps & Tricks
About Unknown
I'm a SharePoint and Collaboration Engineer working in the finance industry in Switzerland. The purpose of this blog is to maintain information, scripts and links which I spent too much time searching for.
Tipps & Tricks
Labels:
JavaScript,
SharePoint,
SharePoint 2013,
Tipps & Tricks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment