Sometimes when we are developing a custom solution, we need to get user info programmatically in SharePoint. It doesn’t matter if you need to show a special message to an specific user using its Personal Name or maybe just fill a SPFieldUser column in a specific list, you’ll probably need one of those code snippets to do the trick.
I’m going to split it into Server-side object model for C# developers, REST API (for SharePoint 2013 projects or newer) and the old-fashioned JavaScript object model introduced in SharePoint 2010. Each one wil let you capture the current user or get an user by its ID or login name. After that it’s up to you what you are going to do with the data.
Continue reading
Recent Comments