Thanks very much Brenden for your help!
I was also trying something similar to this but now stuck at some point and seeking for help.
After this code,
where = "DocumentID = " + dr["DocumentID"] + " AND ModifiedWhen <= '" + selectedDateTime + "'";
versionHistory = VersionHistoryInfoProvider.GetVersionHistories(where, orderBy, topN);
I get only the Document fields but not TreeNode fields and so I again had to use the below code after the above one.
int versionHistoryId = (int)versionHistory.Tables.Rows["VersionHistoryID"];
TreeNode nodeVersion = VersionManager.GetVersion(versionHistoryId, null);
And then I'm converting the above result to a DataSet using the following code,
TreeNodeDataSet trnd = new TreeNodeDataSet(nodeVersion.GetValue("ClassName").ToString(), nodeVersion.GetDataSet());
Then I assign this dataset to a repeater control and inside the repeater_ItemDataBound event, I assign the current DataRow to the CMSRepeater as DataSource along with the transformation name.
Now the problem is that there is neither any AttachmentBinary column nor any such binary data in the above dataset but still the repeater is previewing the attached Figure on the page which is again required for me but it's always showing the latest version figure and not the selected version figure.
After checking few things in database, I got to know that the AttachmentGUID is always same be it for the latest version or the selected version and somehow it's always picking the binary from the table CMS_Attachment instead of CMS_AttachmentHistory and I'm not able to find that where exactly it's picking the binary even when there is no such column in the assigned DataSet and no such code written as well. Is this something done by CMSRepeater itself or by Transformation? And if it's done by Transformation then I would request you to please guide to customise same.
Thanks very much in anticipation!