ListFileVersions Method

Lists the file versions in a bucket.

Syntax

int ListFileVersions(const QString& qsBucketId);

Remarks

This method lists the file versions 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 file versions 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 version, 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 version.

If there are still more files versions available to list when this method returns, the VersionMarker property will be populated. Continue to call this method until VersionMarker 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)

Error Handling

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

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