Search Method
This method searches for resources matching the specified query.
Syntax
onedrive.search(query, [callback])
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This method may be called to search for resources matching the query parameter. The query value will automatically be URL encoded.
After calling this method set ResourceIndex to a value from 0 to ResourceCount - 1. Setting ResourceIndex populates other Resource properties to provide information about the resource. After calling this method the following resource properties are populated:
- ResourceCount
- ResourceCRC32Hash
- ResourceCreatedDate
- ResourceData
- ResourceDeleted
- ResourceDescription
- ResourceDownloadURL
- ResourceETag
- ResourceId
- ResourceIndex
- ResourceMarker
- ResourceMIMEType
- ResourceModifiedDate
- ResourceName
- ResourceParentId
- ResourceParentPath
- ResourcePath
- ResourceSHA1Hash
- ResourceSize
- ResourceType
- ResourceWebURL
If the results are paged ResourceMarker will be populated. Call Search again to retrieve the next page of results. Continue calling Search until ResourceMarker is empty string to retrieve all pages.
Example:
onedrive.Search("vacation photos"); for (int i = 0; i < onedrive.ResourceCount; i++) { onedrive.ResourceIndex = i; Console.WriteLine(onedrive.ResourceName); Console.WriteLine(onedrive.ResourceSize); Console.WriteLine(onedrive.ResourceModifiedDate); }