I want to get fields list of SPSiteItemCollection that limited by SPQuery view fields. for example I limited the view field which CAML query like this:
spQuery.ViewFields="<FieldRef ='TestFieldName' />";
and I executed query with this code and splist.GetItem(spQuery)
passed the result to another function and now I want to get current view fields list in this context I expect to get "TestFieldName" but I don't know how. I know I can find all fields list with codes like this:
List<SPField> fields=listItem.Fields.Cast<SPField>().ToList();
or geting specific view by this code:
List<SPField> fields=list.Views["ViewName"].Fields.Cast<SPField>().ToList();
My question is: how can I get fields list of specific SPQuery view field?
have you try to use the ViewFieldsOnly ? It should return only the fields specified in the query
spQuery.ViewFields="<FieldRef ='TestFieldName' />";
spQuery.ViewFieldsOnly = true;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.