ashhad
ashhad

Reputation: 173

Error uploading attachment : The item was not found or does not exist

I m using RackSpace to upload email attachments. This is how I m trying to upload it to RackSpace Cloud:

//Skipped Authentication Setup
string containerName = ConfigurationManager.AppSettings["ContainerName"];

using (var stream = new MemoryStream())
{
    StreamWriter memoryWriter = new StreamWriter(stream);
    memoryWriter.Write(file);
    stream.Position = 0;
    stream.Seek(0, 0);
    cloudFilesProvider.CreateObject(containerName, stream, fileName);
}

var header = cloudFilesProvider.GetContainerCDNHeader(containerName, "ORD");
string Url = header.CDNSslUri + "/" + fileName;

This code uploads file of size 0 into Cloud and on reaching to header variable, it throws error:

The item was not found or does not exist

Any help would be appreciated.

Upvotes: 0

Views: 219

Answers (1)

hurricanerix
hurricanerix

Reputation: 101

Can you verify that your container is CDN enabled? If it is not, when you HEAD the CDN management URL for the the container, it will return a HTTP 404. I suspect this is what is happening.

I am not sure what libraries you are using, but you can find info on how to CDN enable a container here:

https://developer.rackspace.com/docs/cloud-files/v1/developer-guide/#cdn-enabling-the-container-and-setting-a-ttl

Upvotes: 1

Related Questions