Пример #1
0
        /// 设置存储桶清单任务
        public void PutBucketInventory()
        {
            //.cssg-snippet-body-start:[put-bucket-inventory]
            try
            {
                string inventoryId = "aInventoryId";
                string bucket      = "examplebucket-1250000000"; //格式:BucketName-APPID
                PutBucketInventoryRequest putRequest = new PutBucketInventoryRequest(bucket, inventoryId);
                putRequest.SetDestination("CSV", "100000000001", "examplebucket-1250000000", "ap-guangzhou", "list1");
                putRequest.IsEnable(true);
                putRequest.SetScheduleFrequency("Daily");
                //执行请求
                PutBucketInventoryResult putResult = cosXml.PutBucketInventory(putRequest);

                //请求成功
                Console.WriteLine(putResult.GetResultInfo());
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                //请求失败
                Console.WriteLine("CosClientException: " + clientEx);
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                //请求失败
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
            }
            //.cssg-snippet-body-end
        }