有没有办法通过REST检索站点用户/组的列表,类似于使用listdata.svc获取列表数据的方法?我想获取站点上所有用户和组的列表,以便我可以输入用户输入名称(例如 John Smith),然后我可以将该名称映射到相关用户 ID(例如 John Smith 的 ID:3),以便在将更新推送到列表项时使用,因为您必须为此使用 ID。
答案是肯定的。 这是使用休息的法典。
仅限组:
[Site]/_vti_bin/Listdata.svc/UserInformationList?$filter=substringof('SharePointGroup',ContentType) eq true
仅限人员:
[Site]/_vti_bin/Listdata.svc/UserInformationList?$filter=substringof('Person',ContentType) eq true
双:
[Site]/_vti_bin/Listdata.svc/UserInformationList
使用这些方法中的任何一种,您都可以获得id等
<m:properties>
<d:ContentTypeID>0x010....</d:ContentTypeID>
<d:Name>Doe, John</d:Name>
<d:Account>ABCjohn.doe</d:Account>
<d:WorkEMail>jd@abc.com</d:WorkEMail>
<d:MobilePhone m:null="true" />
<d:AboutMe m:null="true" />
<d:SIPAddress m:null="true" />
<d:IsSiteAdmin m:type="Edm.Boolean">false</d:IsSiteAdmin>
<d:Deleted m:type="Edm.Boolean">false</d:Deleted>
<d:Picture m:null="true" />
<d:Department m:null="true" />
<d:Title m:null="true" />
<d:FirstName>John</d:FirstName>
<d:LastName>Doe</d:LastName>
<d:UserName>John.Doe</d:UserName>
<d:WebSite m:null="true" />
<d:AskMeAbout m:null="true" />
<d:WorkPhone>8885551212</d:WorkPhone>
<d:Office m:null="true" />
<d:Unit m:null="true" />
<d:Id m:type="Edm.Int32">2</d:Id>
<d:ContentType>Person</d:ContentType>
<d:Modified m:type="Edm.DateTime">2016-09-27T00:00:19</d:Modified>
<d:Created m:type="Edm.DateTime">2013-10-17T12:13:59</d:Created>
<d:CreatedById m:type="Edm.Int32">3</d:CreatedById>
<d:ModifiedById m:type="Edm.Int32">1073741823</d:ModifiedById>
<d:Owshiddenversion m:type="Edm.Int32">217</d:Owshiddenversion>
<d:Version>1.0</d:Version>
<d:Path>/sites/test/_catalogs/users</d:Path>
</m:properties>