用于深度嵌套数据的OData REST筛选器
我有一个working-REST请求,它返回一个大的结果集合。(此处修剪) 原始URL为:用于深度嵌套数据的OData REST筛选器,rest,filter,odata,Rest,Filter,Odata,我有一个working-REST请求,它返回一个大的结果集合。(此处修剪) 原始URL为: http://intranet.domain.com//_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domain\kens'&$select=AccountName,DisplayName,Email,Title,UserProfileProperties 答复是: { "d": { "_
http://intranet.domain.com//_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domain\kens'&$select=AccountName,DisplayName,Email,Title,UserProfileProperties
答复是:
{
"d": {
"__metadata": {
"id": "stuff",
"uri": "morestuff",
"type": "SP.UserProfiles.PersonProperties"
},
"AccountName": "domain\\KenS",
"DisplayName": "Ken Sanchez",
"Email": "KenS@domain.com",
"Title": "Research Assistant",
"UserProfileProperties": {
"results": [
{
"__metadata": {
"type": "SP.KeyValue"
},
"Key": "UserProfile_GUID",
"Value": "1c419284-604e-41a8-906f-ac34fd4068ab",
"ValueType": "Edm.String"
},
{
"__metadata": {
"type": "SP.KeyValue"
},
"Key": "SID",
"Value": "S-1-5-21-2740942301-4273591597-3258045437-1132",
"ValueType": "Edm.String"
},
{
"__metadata": {
"type": "SP.KeyValue"
},
"Key": "ADGuid",
"Value": "",
"ValueType": "Edm.String"
},
{
"__metadata": {
"type": "SP.KeyValue"
},
"Key": "AccountName",
"Value": "domain\\KenS",
"ValueType": "Edm.String"
}...
是否可以使用$filter更改REST请求,该$filter只返回Key=SID或Key=other值的results集合中的键值
我只需要从结果集合中按名称列出大约3个值 在OData中,无法过滤内部提要 相反,您可以尝试查询UserProfileProperties来自的实体集,并展开关联的SP.UserProfiles.PersonProperties实体 语法需要根据您的场景进行调整,但我的想法是:
service.svc/UserProfileProperties?$filter=Key eq 'SID' and RelatedPersonProperties/AccountName eq 'domain\kens'&$expand=RelatedPersonProperties
这假设您有一个UserProfileProperties的顶级实体集,每个实体都通过一个名为RelatedPersonProperties的导航属性(在我的示例中)绑定到一个SP.UserProfiles.PersonProperties实体。您可以共享您的原始请求(URI)吗?这将有助于找到答案。