背景:
阅读新闻

SharePoint User List

  作者: 今日评论: [字体: ]
In SharePoint, you can access the User Information List to get basic data about a user. This list is hidden and there’s no direct link provided by Microsoft to access the list. Let’s see how we can access this list and what all the data we can get from the User Information List. 
 

User Information List - Important Information

  • The user Information list is hidden, and users don’t have any direct link to access it.
  • User Information List contains data about the user added as part of their Active Directory (AD) profile configuration
  • User Information List resides only in Root Site Collection.
  • Whenever you grant access to the user on SharePoint site/list or any other resource, the user automatically gets added in this list.
  • When any user modifies or creates any list or library object, the item gets saved with last modified by/created by metadata. This information is taken from User Information List.
  • If any AD Group is given permission on site, the group will also be added to the User Information List and also the Group-users will be added to the list.
  • You can access User Information list only if you are an Admin of the site.

URL to access the User Information list?

 
You can enter the URL in browser to access the list directly. You can see the difference in both the screenshots.
  • https://SiteURL/_catalogs/users/detail.aspx - Get detailed information for users
  • https://SiteURL/_catalogs/users/simple.aspx - Get basic information for users
Access SharePoint User Information list using REST API
  1. function GetAllFieldsFromList() {  
  2.     $.ajax  
  3.         ({  
  4.             // _spPageContextInfo.webAbsoluteUrl - will give absolute URL of the site where you are running the code.  
  5.             url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getByTitle('User Information List')/fields",  
  6.             method: "GET",  
  7.             headers:  
  8.                {  
  9.                    "Accept""application/json;odata=verbose"  
  10.                },  
  11.             success: function (data, status, xhr) {  
  12.                 var dataresults = data.d.results;  
  13.                 for (var i = 0; i < dataresults.length; i++) {   
  14.                     console.log(dataresults[i]["Title"]);  
  15.                 }  
  16.             },  
  17.             error: function (xhr, status, error) {  
  18.                 console.log("Failed");  
  19.             }  
  20.         });  
  21. }  
Access SharePoint User Information list using CSOM
  1. using Microsoft.SharePoint.Client;  
  2. using System.Linq;  
  3. using(ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection")) {  
  4.     List targetList = clientcontext.Web.SiteUserInfoList;  
  5.     FieldCollection oFieldCollection = targetList.Fields;  
  6.     clientcontext.Load(oFieldCollection, oFields => oFields.Include(field => field.Title));  
  7.     clientcontext.ExecuteQuery();  
  8.     foreach(Field oField in oFieldCollection) {  
  9.         Console.WriteLine("Field Name- " + oField.Title);  
  10.     }  
  11. }   
来源:https://www.c-sharpcorner.com/blogs/everything-you-need-to-know-about-user-information-list-in-share
录入日期:[2020/06/29 14:29:00]
收藏 推荐 打印 | 录入:mikebai | 阅读:
文章评论      
正在加载评论列表...
评论表单加载中...