Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  




           


Query SharePoint Document by Custom Field using API
Use the REST api by starting with getbytitle based on the root folder of your search:

/_api/web/lists/getbytitle('My%20Library')/Items

Append 'filter' to filter search by your custom field: (e.g MYCUSTOMFIELD = abc):
&$filter=MYCUSTOMFIELD%20eq%20abc

Append 'select' to select your custom field and the file name (FileRef):

&$select=FileRef,MYCUSTOMFIELD

You can also add ServerUrl or other properties as needed.

Then use the SharePoint REST API in .NET to load your items:
var api = new {namespace}.MS.FileServices.ApiData(apiUrl);
api.Credentials = CredentialCache.DefaultCredentials;
var uItems = new Uri(restUrl);
var spItems = api.Execute<{namespace}.SP.Data.{LibraryItemTypeReturned}>(uItems).ToList();

Created By: amos 11/27/2017 12:41:14 PM
Updated: 11/27/2017 5:03:05 PM