It looks like you're calling the method with an unexpected argument. The CreateObjectFromFile
method takes a headers
dictionary, which is actually the raw HTTP headers to add to the request. Since the Metadata
class is derived from Dictionary<string, string>
, your code still compiles when you pass a Metadata
for this argument, yet the result is not as you'd expect.
There is no direct support in the SDK for including a Metadata
object in the call to CreateObjectFromFile
. In addition, the OpenStack Object Storage API Reference does not include any information about including headers in the underlying Create Object API method.
You have two ways you can approach this problem:
- Use the documented
UpdateObjectMetadata
call after you create the object. - Attempt to use an undocumented feature of adding
X-Object-Meta-xxx
metadata in theheaders
passed to theCreateObjectFromFile
method (this may or may not work, may vary between OpenStack implementations, and may change behavior at any time).
Obviously I recommend you stick with the documented method. :)