Skip to main content
StorageFileQueryResult.FindStartIndexAsync | findStartIndexAsync method

Retrieves the index of the file from the query results that most closely matches the specified property value (or file, if used with FileActivatedEventArgs.NeighboringFilesQuery). The property that is matched is determined by the first SortEntry of the QueryOptions.SortOrder list.


storageFileQueryResult.findStartIndexAsync(value).done( /* Your success and error handlers */ );

public IAsyncOperation<uint> FindStartIndexAsync(
  object value

Public Function FindStartIndexAsync(
  value As Object 
) As IAsyncOperation(Of UInteger)

IAsyncOperation<unsigned int>^ FindStartIndexAsync(
  Object^ value



Type: Object [JavaScript] | System.Object [.NET] | Platform::Object [C++]

The property value to match when searching the query results. The property to that is used to match this value is the property in the first SortEntry of the QueryOptions.SortOrder list.

Or, the file to match when searching with FileActivatedEventArgs.NeighboringFilesQuery.

Return value

Type: IAsyncOperation<UInt32>

When this method completes successfully, it returns the index of the matched file in the query results or the index of the file in the FileActivatedEventArgs.NeighboringFilesQuery. In the latter case, the file is expected to be sourced from FileActivatedEventArgs.Files. If this function fails, it returns uint.MaxValue.


You can use this method in conjunction with FileActivatedEventArgs.NeighboringFilesQuery to iterate between neighboring files while preserving the original view's sort order.

You can use this index in conjunction with Semantic Zoom to determine where the page should be zoomed in after the user selects the Semantic Zoom control. To learn about SemanticZoom in JavaScript, see Quickstart: adding SemanticZoom controls. To learn about SemanticZoom in C#/C++/VB, see Quickstart: adding SemanticZoom controls.


This example shows how to find the first song in an album that has a title beginning with the "R" in a set of query results that contains songs grouped by album title.

QueryOptions queryOptions = new QueryOptions();
queryOptions.FolderDepth = FolderDepth.Deep;
queryOptions.IndexerOption = IndexerOption.OnlyUseIndexer;
SortEntry album = new SortEntry();
album.AscendingOrder = true;
album.PropertyName = "System.Music.AlbumTitle";

StorageFileQueryResult queryResult = musicFolder.CreateFileQueryWithOptions(queryOptions);
var firstIndex = await queryResult.FindStartIndexAsync("R");

var queryOptions = new Windows.Storage.Search.QueryOptions();
queryOptions.folderDepth = Windows.Storage.Search.FolderDepth.deep;
queryOptions.indexerOption = Windows.Storage.Search.IndexerOptions.onlyUseIndexer;
 ascendingOrder: true,
 propertyName: "System.Music.AlbumTitle"

var queryResult = Windows.Storage.KnownFolders.picturesLibrary.createFileQueryWithOptions(queryOptions);
var firstIndex = queryResult.findStartIndexAsync("R");

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::Storage::Search [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows 10 Mobile


Windows::Storage::Search [C++]



See also