Sample code for 30+ languages & platforms
PowerBuilder

OSS Delete Bucket Objects (Alibaba Cloud)

See more Alibaba Cloud OSS Examples

Demonstrates how to delete objects in a bucket.

The Chilkat S3 functions in the HTTP class are compatible with Alibaba Cloud's OSS service.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
string ls_BucketName
string ls_ObjectName1
string ls_ObjectName2
oleobject loo_St
oleobject loo_Resp

li_Success = 0

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Insert your AccessKey ID here:
loo_Http.AwsAccessKey = "access-key"

// Insert your AccessKey Secret here:
loo_Http.AwsSecretKey = "secret-key"

// To delete objects from a bucket located in a different region, use the domain for that region, such as "oss-cn-hangzhou.aliyuncs.com 	"
// See Alibaba Object Storage Service Regions and Endpoints
loo_Http.AwsEndpoint = "oss-us-east-1.aliyuncs.com"

ls_BucketName = "chilkat"

ls_ObjectName1 = "seahorse.jpg"
ls_ObjectName2 = "orchard.json"

loo_St = create oleobject
li_rc = loo_St.ConnectToNewObject("Chilkat.StringTable")

loo_St.Append(ls_ObjectName1)
loo_St.Append(ls_ObjectName2)

loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")

li_Success = loo_Http.S3_DeleteObjects(ls_BucketName,loo_St,loo_Resp)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_St
    destroy loo_Resp
    return
end if

Write-Debug "Response status code = " + string(loo_Http.LastStatus)

// Display the XML response.
Write-Debug loo_Resp.BodyStr


destroy loo_Http
destroy loo_St
destroy loo_Resp