HEAD Object

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference

You can call ObsClient.HeadObject to check whether a specified object exists. The following code shows how to use the function:

// // Create an instance of ObsClient.
ObsClient client = new ObsClient("*** Provide your Access Key ***", "*** Provide your Secret Key ***", "https://your-endpoint");
// Check whether the specified object exists.
try
{
    HeadObjectRequest request = new HeadObjectRequest()
    {
        BucketName = "bucketName",
        ObjectKey = "objectKey"
    };
    bool response = client.HeadObject(request);
    Console.WriteLine("Head object response: {0}", response);
}
catch (ObsException ex)
{
    Console.WriteLine("Exception errorcode: {0}, when head object.", ex.ErrorCode);
    Console.WriteLine("Exception errormessage: {0}", ex.ErrorMessage);
}