Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4587718
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:49:13+00:00 2026-05-21T21:49:13+00:00

I have turned on the versioning option for my bucket. I have also uploaded

  • 0

I have turned on the versioning option for my bucket. I have also uploaded a file twice to a folder in my bucket with the same name, creating two revisions of the file.

e.g. mybucket/myfile.jpg (revision 1 and revision 2 (current))

I am trying to use the AmazonS3 .NET tools to get a list of the versions for a single file as mentioned above. As I want the functionality for a user to be able to download a previous version of the uploaded file.

Here is a method that I have created, I am able to get a list of all the files in my bucket/folder. But not a specific file in the bucket/folder (I call it a folder, but is is a key / object in itself).

public String AmazonS3GetObjectVersions(Guid DocumentId)
{
    AmazonS3 s3Client = AmazonS3ClientConnection();

    GetObjectMetadataRequest ORequest = new GetObjectMetadataRequest();
    ORequest.BucketName = DocumentStorageFolder(DocumentId); // e.g. mybucket
    ORequest.Key = DocumentStorageReference(DocumentId); // e.g. myfolder/myfile.jpg

    GetObjectMetadataResponse OResponse = s3Client.GetObjectMetadata(ORequest);

    S3ObjectVersion version = new S3ObjectVersion();
    version.BucketName = DocumentStorageFolder(DocumentId);
    version.Key = DocumentStorageReference(DocumentId);
    version.IsDeleteMarker = false;

    ListVersionsRequest Request = new ListVersionsRequest();
    Request.BucketName = DocumentStorageFolder(DocumentId);

    String tmp = DocumentStorageReference(DocumentId);

    string[] tmparr = tmp.Split('/');

    Request.KeyMarker = tmparr[0];
    //Request.Delimiter = "/";
    //Request.MaxKeys = int.Parse(appConfig["MAX_VERSIONS"]);

    ListVersionsResponse Response = s3Client.ListVersions(Request);

   //Response.NextKeyMarker = tmparr[1];

   Response.KeyMarker = tmparr[1];

   List<S3ObjectVersion> Versions = new List<S3ObjectVersion>();

   Versions = Response.Versions;

   return Versions.ToString();
}

I have tried a few of the available classes, however I am unable to get the version history for a single file. (Probably missing something small)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:49:13+00:00Added an answer on May 21, 2026 at 9:49 pm

    As you mentioned, you are missing a small thing. Use prefix of the ListVersionsRequest

    E.g.

    ListVersionsRequest Request = new ListVersionsRequest();
    Request.BucketName = DocumentStorageFolder(DocumentId);
    Request.Prefix = KeyName
    

    Kamal

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is my nlog.config file. I have turned on the throwsException. <nlog xmlns=http://www.nlog-project.org/schemas/NLog.xsd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
I have a list in SharePoint that has versioning turned on. This list contains
i have turned off index.php in my codeigniter by .htaccess and also i left
I have turned headers off in the report server config file and am attempting
Inside an UpdatePanel I have two PlaceHolders which are never visible at the same
I have turned on warnings as errors and now i need to XML comment
I have turned computer monitor off using this command SendMessage(f.Handle, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)(turnOff ?
I have turned a normal PHP class into a library so I can use
I have turned off lazy loading and the proxy creation on my DbContext. I
(Before anyone says anything Yes this was homework but i have already turned it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.