Search for a List of Files or Folders
Retrieves metadata information of search results. The metadata includes information such as the creation time, modified time, item type, name, path, and size.
The search can across all share folders to which the user has access. Alternately, the search can target specific scopes.
URI Template
GET services/builtin/FileOperationService.svc/items/index/{index}
/count/{count}
/search?query={query}
&sortByField={sortByField}
&ascending={ascending}
&scope={scope}
&timeoutseconds={timeoutSeconds}
index
The index of the first data requested.
count
The number of search result metadata blocks requested.
query
The query to search on. You must specify the start of the file name to search the results. The query supports * and ?.
sortByField
The fields the result is sorted by. You can sort by default, date, description, location, name, and size. The default value is default.
ascending
true if sorting is ascending. false if sorting is not descending. The default value is true.
scope
(optional) The scope the search will be limited to. Otherwise, the search includes all share folders the user has permission to access.
timeoutseconds
(optional) The search timeout threshold. The default value is 10 seconds.
Sample Request
GET https://www.contoso.com/services/builtin/FileOperationService.svc/items/index/0/count/100/search?query=abc&sortByField=name&ascending=true HTTP/1.1
Accept: application/xml
Cookie: ASP.NET_SessionId=********************
Canary: *********************
Host: domainname
Sample Response
HTTP/1.1 200 OK
<ItemList xmlns="http://contracts.microsoft.com/WindowsServerEssentials/2011/09/WebApi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Items>
<ItemInfo>
<AccessPermission>2</AccessPermission>
<CreateTime>2011-10-18T01:08:01.3153356-07:00</CreateTime>
<IsDirectory>true</IsDirectory>
<ModifiedTime>2011-10-18T01:08:01.3153356-07:00</ModifiedTime>
<Name>aa</Name>
<Path>\\SERVERNAME\Users</Path>
<Size>0</Size>
</ItemInfo>
<ItemInfo>
<AccessPermission>2</AccessPermission>
<CreateTime>2011-10-12T23:24:59.3006647-07:00</CreateTime>
<IsDirectory>true</IsDirectory>
<ModifiedTime>2011-10-18T19:49:06.1585762-07:00</ModifiedTime>
<Name>AuroraStdUser</Name>
<Path>\\SERVERNAME\Users</Path>
<Size>0</Size>
</ItemInfo>
<ItemInfo>
<AccessPermission>2</AccessPermission>
<CreateTime>2011-10-12T23:24:58.3945353-07:00</CreateTime>
<IsDirectory>true</IsDirectory>
<ModifiedTime>2011-10-16T20:03:33.9386717-07:00</ModifiedTime>
<Name>AuroraUser</Name>
<Path>\\SERVERNAME\Users</Path>
<Size>0</Size>
</ItemInfo>
<ItemInfo>
<AccessPermission>2</AccessPermission>
<CreateTime>2011-10-18T01:12:36.9315201-07:00</CreateTime>
<IsDirectory>true</IsDirectory>
<ModifiedTime>2011-10-18T01:12:36.9315201-07:00</ModifiedTime>
<Name>Sallyh</Name>
<Path>\\SERVERNAME\Users</Path>
<Size>0</Size>
</ItemInfo>
</Items>
<TotalCount>2</TotalCount>
<UnsearchedShares i:nil="true" xmlns:a="https://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</ItemList>
Error Codes
Error Code | Error Message |
---|---|
400 | One of the parameters is invalid. |
401 | Access to the requested resource is denied. |
Remarks
The AccessPermission element is defined as the following:
Number | Value |
---|---|
0 | None |
1 | ReadOnly |
2 | Full |
3 | Other |