IPWorks Cloud 2020 ActiveX Edition

Questions / Feedback?

ListFiles Method

Lists the files in a bucket.

Syntax

backblazeb2control.ListFiles BucketId

Remarks

This method lists the files in the bucket specified by BucketId.

Before calling this method, the Prefix property may be set in order to restrict the results to only the files whose names begin with the a given string. The Delimiter property can also be used to further tune the results returned. The MaxResults configuration setting may also be used to limit the number of results returned.

If the currently-authenticated application key is restricted to a specific file name prefix (indicated by the AccountAllowedPrefix property being non-empty), then the Prefix property will automatically be set to that prefix if it is empty when this method is called.

Calling this method will fire the FileList event once for each file, and will also populate the File* properties. If the ListWithMetadata configuration setting is enabled, the MetadataList event will also be fired, once for each metadata item associated with each file.

If there are still more files available to list when this method returns, the FileMarker property will be populated. Continue to call this method until FileMarker is empty to accumulate all pages of results in the File* properties.

The currently-authenticated application key must have the listFiles capability to call this method successfully, otherwise the server will return an error. Refer to the AccountCapabilities property for more information.

File Hierarchy Traversal

By using the Delimiter and Prefix properties in tandem, applications can effectively "traverse" a virtual hierarchy of files (or file versions) as if it were a filesystem. For example, assume that files with the following names exist within a bucket:

  • MyCompany
  • MyCompany/Department1
  • MyCompany/Department2
  • MyCompany/Department2/EmployeeA
  • MyCompany/Department2/EmployeeB

With Delimiter set to /, we can set Prefix to successively "deeper" values before calling ListFiles or ListFileVersions for the following effect:

Prefix Value Files Returned Folders Returned
(empty) MyCompany MyCompany/
MyCompany/ MyCompany/Department1
MyCompany/Department2
MyCompany/Department2/
MyCompany/Department2/ MyCompany/Department2/EmployeeA
MyCompany/Department2/EmployeeB
(none)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 ActiveX Edition - Version 20.0 [Build 8265]