Using jQuery to find the current logged in user #in #SP2010
In MOSS 2007, we had methods to get the current logged in user by accessing some of the properties found in the Welcome Menu.
Although this is still the case in SharePoint Server 2010, there are some fundamental changes to the code and the way the Welcome Menu is rendered in SPS 2010 that means we have to do something slightly different to get the same result.
I have recently had a requirement to achieve this in my current project and thought I would share the basics with you.
Essentially we are still retrieving the information from an HTML element property in the Welcome Menu, but the menu itself is rendered in AJAX and therefore is not necessarily available as soon as the page is rendered and the DOM document ready state is set.
will not return the required result, since the menu elements we need to interrogate have not been rendered yet.
- Set a timer to keep running a particular function to wait until the menu is rendered
- Stop the timer
- Interrogate the DOM as required using jQuery