是否有一种方法可以通过REST检索站点用户/组列表,类似于如何使用listdata.svc获取列表数据?我想获取站点上所有用户和组的列表,以便输入用户输入的名称(例如John Smith),然后将该名称映射到相关的用户ID (例如John Smith的ID:3),以便在将更新推到列表项目时使用,因为您必须为此使用ID。
发布于 2016-10-11 20:29:58
答案是肯定的。下面是使用rest的codez。
仅限团体:
[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>ABC\john.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>https://stackoverflow.com/questions/36088553
复制相似问题