Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't read Amazon S3 Object meta-data using .Net API, what am I doing wrong?

I've read the S3 documentation several times and I'm adding metadata to an S3 object with this code...

PutObjectRequest titledRequest = new PutObjectRequest();
titledRequest.WithTimeout(3600000)
.WithMetaData("outputfolder", outputFolder)
.WithBucketName(AWS_BUCKET_NAME)
.WithKey(objectKey)
.WithAutoCloseStream(true)
.WithInputStream(fs);

When reading the object from the S3 bucket I'm using this code....

string outputFolder = response.Metadata["x-amz-meta-outputfolder"];

But I'm getting an empty string every time even though the outputFolder variable definitely has a value.

Am I doing something really silly wrong here? As far as I can tell this is consistent with the documentation

like image 659
user582232 Avatar asked Mar 27 '26 11:03

user582232


1 Answers

string outputFolder = response.Metadata["outputfolder"];

will do.

like image 194
Tom Avatar answered Mar 29 '26 00:03

Tom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!