API | 操作名 | 操作描述 |
设置版本控制 | 设置存储桶的版本控制功能 | |
查询版本控制 | 查询存储桶的版本控制信息 |
// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";PutBucketVersioningRequest request = new PutBucketVersioningRequest(bucket);request.IsEnableVersionConfig(true); //true: 开启版本控制; false:暂停版本控制try{PutBucketVersioningResult result = cosXml.PutBucketVersioning(request);Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";GetBucketVersioningRequest request = new GetBucketVersioningRequest(bucket);try{GetBucketVersioningResult result = cosXml.GetBucketVersioning(request);// 存储桶的生命周期配置VersioningConfiguration conf = result.versioningConfiguration;}catch (COSXML.CosException.CosClientException clientEx){Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
本页内容是否解决了您的问题?