IIQAPISearch Method |
Namespace: Informa.ImageQuest.API.Library
The Search(String, String, String) method is documented as returning a generic ListT containing IQDocument objects. In most cases, the SOAP proxy class generator will serialize this data as a fixed-length array.
ImageQuest searches performed via the API can be done using either the full text search feature, or using the index metadata via an IQQL query. See the ImageQuest API User's Guide for a full description of the IQQL syntax.
using ( IIQAPI api = new ImageQuestService.IQAPIClient() ) { string token = api.SystemLogin("ImageQuest"); IQDocument[] documents = api.Search(token, "[DocumentType] = 'Invoice' AND [CustomerNumber] = '105-B'", String.Empty); foreach ( IQDocument document in documents ) { List<IQDocumentAttribute> metadata = new List<IQDocumentAttribute>(document.Metadata); byte[] data = api.GetDocumentStream(token, document.Id); string fileName = String.Format("{0}_{1}_{2}.{3}", metadata.Single(attribute => attribute.Name == "CustomerNumber").Value, metadata.Single(attribute => attribute.Name == "InvoiceNumber").Value, DateTime.Today.ToString("yyyyMMdd_hhmmss"), metadata.Single(attribute => attribute.Name == "FileType").Value ); File.WriteAllBytes(fileName, data); } }