Sometimes you need to get information abot some user. To do so you need the SiteUserInfoList. This list contains data about all user that visited the SharePoint site. This is how you can read the list with C# and CSOM:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| // build the SharePoint connection
ClientContext clientContext = new ClientContext("http://your site/");
Web web = clientContext.Web;
// get the userinfolist
List siteUserInfoList = web.SiteUserInfoList;
// build a query
CamlQuery query = new CamlQuery();
query.ViewXml = "";
// get the data
IEnumerable<ListItem> itemColl = clientContext.LoadQuery(siteUserInfoList.GetItems(query));
clientContext.ExecuteQuery();
// work with the userinformations
foreach (var item in itemColl)
{
Console.WriteLine("ID:{0} Email:{1} Title:{2}", item.Id, item["EMail"], item["Title"]);
}
|
Comments
Post a Comment