简体   繁体   English

使用REST API从查找列检索用户属性

[英]Retrieve User Properties from a lookup Column using REST api

i have a SharePoint list where i hold the list of users i intend to retrieve the pictureurl for each users. 我有一个SharePoint列表,其中保存了用户列表,我打算为每个用户检索pictureurl。

How do i retrieve all the properties of the lookup so i can figure out which properties i need. 我如何检索查询的所有属性,以便可以找出需要的属性。 In my example i know there is a Title and Name property, how can i know what the rest are using Console.log 在我的示例中,我知道有一个Title和Name属性,我如何才能知道其余的正在使用Console.log

var getsiteContacts = function siteContacts () {

     // execute AJAX request
    $.ajax({
             url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Site Contact')/items?$select=user/Title,user/Name&$expand=user",
             type: "GET",
             headers: { "ACCEPT": "application/json;odata=verbose" },
             success: function (data) {



             var DataResult = data.d.results;
             //var user = DataResult.userId;
             for (var i = 0; i < DataResult.length; i++) {

                if(DataResult[i].user!=null){
                    var userDetails1 = DataResult[i].user.Name.split('|')[1];
                    var userDetails = DataResult[i].user.Name;


                    //Get the user profile picture for each user
                    console.log(userDetails);
                    console.log(data);

             }
                getProfilePicture(userDetails); 

            }                 


         },
            error: function () {
            //alert("Failed to get details");
        }

    });


}

Below are the user properties that you can use. 以下是您可以使用的用户属性。

1 Id 2 ContentTypeID 3 ContentType 4 Name 5 Modified 6 Created 7 Account 8 EMail 9 MobileNumber 10 AboutMe 11 SIPAddress 12 IsSiteAdmin 13 Deleted 14 Hidden 15 Picture 16 Department 17 JobTitle 18 LastName 19 FirstName 1 ID 2 ContentTypeID 3 ContentType 4名称5已修改6已创建7帐户8电子邮件9 MobileNumber 10 AboutMe 11 SIPAddress 12 IsSiteAdmin 13已删除14隐藏15图片16部门17 JobTitle 18 LastName 19 FirstName

If you want to display Email Address or First Name or Last Name , You need to construct the URI as below. 如果要显示电子邮件地址或名字或姓氏,则需要按以下方式构造URI。

_api/web/lists/getbytitle('Site Contact')/items?$select=Users/EMail,Users/FirstName,Users/LastName,Users/EMail&$expand=Users/Id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM