The method iLogicVault.GetFileBySearchCriteria expects to specify search criteria that return a single result; the description of the method tells that only the first file found will download in case of multiple files found, so you should apply search criteria that return a single, unique result:
/// Search for a file by 1 to many search criteria as property/value pairs.
/// Downloads the first file found, if the search result lists more than a single file. Dependents and attachments are included. Overwrites existing files.
/// Preset Search Operator Options: [Property] is (exactly) [Value]; multiple conditions link up using AND/OR condition, depending MatchAllCriteria = True/False
/// Returns the file name downloaded (does not return names of downloaded children and attachments).
For your objective - downloading all files related to Item Number xy, use the method GetFilesBySearchCriteria (Note File vs. FileS in the name:
/// <summary>
/// Search for multiple files by 1 to many search criteria as property/value pairs.
/// Downloads all files found, matching the criteria. Dependents and attachments are included. Overwrites existing files.
/// Preset Search Operator Options: [Property] is (exactly) [Value]; multiple conditions link up using AND/OR condition, depending MatchAllCriteria = True/False
/// Returns list of files names downloaded (does not return names of downloaded children and attachments).
/// </summary>
I hope this helps to understand that your approach does not secure a consistent, predictable result.
Markus Koechl
Solutions Engineer PDM, Autodesk Central Europe