Reputation: 1
I am trying to create a "directory" inside a Container, as long as I have read the rackspace api, to create it you should create a 0 or 1 byte object and assign the value "application/directory" to the Content-Type.
I tried this:
var cloudFilesProvider = new CloudFilesProvider(_cloudIdentity);
Dictionary<string, string> dicHeaders = new Dictionary<string, string>();
dicHeaders.Add("name", "application/directory");
MemoryStream ms = new MemoryStream(1);
cloudFilesProvider.CreateObject(ContainerName, ms, DirectoryPath, 0, dicHeaders);
But I get an exception
The 'Content-Type' header must be modified using the appropriate property or method. Parameter name: name
Do anyone have created these kind of object?
Upvotes: 0
Views: 899
Reputation: 61
I think you are adding the wrong header. Instead of "name", try setting the value to "ContentType":
dicHeaders.Add("ContentType", "application/directory");
Update: I think that in general directories are not needed. Let's say you create an object, called "User/Foo/Bar.jpg". If you look in your container through the website, you will the image with this name. However, if you open your container with CyberDuck, you will find a folder User, inside it another one called Foo, and inside it will be the file Bar.jpg.
Upvotes: 2