wiliammbr's blog

Some thoughts on SharePoint and other random stuff

Get user info programmatically in SharePoint

Once in a while we need to gather some user information and use it many ways. It doesn’t matter if you need to show a special message to an specific user using its Personal Name or maybe just fill an SPFieldUser in a specific list, you’ll probably need those snippets to do the trick.

I’m going to divide it into Server-side object model for C# users, REST API (for SharePoint 2013 projects or newer) and the old-fashioned JavaScript object model introduced in SharePoint 2010.

Server side:

SharePoint REST API:

SharePoint JavaScript Client Object Model:

Well, that’s all for today. Thanks for reading and I hope it can be useful to you.

References:
Samarendra Swain – SharePoint
MSDN Library
Code Project – SharePoint REST API – Get User Id by User Name

2 Comments

  1. Nice compilation. Thanks

Comments are closed.

© 2017 wiliammbr's blog

Theme by Anders NorenUp ↑