public static List <BosObjectSummary> ListObjects() { if (BosConfig == null) { return(null); } ListObjectsRequest listObjectsRequest = new ListObjectsRequest() { BucketName = BosConfig.BucketName, MaxKeys = 5 }; List <BosObjectSummary> allObjects = new List <BosObjectSummary>(); // 获取指定Bucket下的所有Object信息 BaiduBce.Services.Bos.Model.ListObjectsResponse listObjectsResponse = GetBosClient().ListObjects(listObjectsRequest); allObjects.AddRange(listObjectsResponse.Contents); while (listObjectsResponse.NextMarker != null) { listObjectsRequest.Marker = listObjectsResponse.NextMarker; listObjectsResponse = GetBosClient().ListObjects(listObjectsRequest); allObjects.AddRange(listObjectsResponse.Contents); } return(allObjects); }
public List <BosObjectSummary> ListObjects(string bucketName, string prefix) { BaiduBce.Services.Bos.Model.ListObjectsResponse response = _bosClient.ListObjects(bucketName, prefix); //response. //ObjectListing list = BuilderObjectLising(bucketName, response); return(response.Contents); }