cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically retrieve content for archived item

AndrewB
Moderator
Moderator
Partner    VIP    Accredited

I'm trying to retrieve content for an archived item using the EV 8.0 SP1 API and working in Visual Studio 2008 C# (see code fragment attached).
Using the IFileStream class suggested by Symantec in the application programmer's guide I have been able to retrieve details regarding the item (e.g. title, location, size, etc.) but the item content being returned appears to be garbage.

If anybody has this working and can see what I am doing wrong I would appreciate any suggestions you can provide.
 

1 ACCEPTED SOLUTION

Accepted Solutions

MichelZ
Level 6
Partner Accredited Certified
Andrew

What happens if you set vaultItem.Content.Data to  "C:\Temp\Data.txt" ?
Does that work?

Cheers
Michel

cloudficient - EV Migration, creators of EVComplete.

View solution in original post

4 REPLIES 4

Michael_Bilsbor
Level 6
Accredited


You appear to have converted the Stream into a byte array so all you will see is the binary content of the file, what you should be doing is saving the stream to disk or instead of using a stream set IContent::Data to a disk location,you should than just be able to open the file.

Cheers,
Mike

AndrewB
Moderator
Moderator
Partner    VIP    Accredited
Thanks for the suggestion. I set up a StreamWriter object that references a file on disk and set
IContent.Data to the StreamWriter object (writer). After running the code I don't see
any data written to the file. Hopefully I followed your suggestion correctly. If not, do you have a
snippet of code available that illustrates your suggestion?
 
// Define the item to be retrieved.
vaultItem = contentMgmt.Item;
vaultItem.ArchiveId = archiveId;
vaultItem.Id = (string)result.Prop(IndexProperties.IndexPropSSID);
 
StreamWriter writer = new StreamWriter(@"C:\Temp\Data.txt");
vaultItem.Content.Data = writer;
 
vaultItem.Get((int)(EV_STG_API_ITEM_DETAIL.DETAIL_LEVEL_ITEM_PROPERTIES | EV_STG_API_ITEM_DETAIL.DETAIL_LEVEL_ITEM_CONTENT));
 
// Get details of archived item (e.g. location, title, size, etc.).
title = vaultItem.Content.Title;
fileExtension = vaultItem.Content.FileExtension;
originalLocation = vaultItem.Content.OriginalLocation;
originalSize = Convert.ToInt32(vaultItem.Content.OriginalSize);
modifiedDate = DateTime.FromOADate(Convert.ToDouble(vaultItem.Content.ModifiedDate));

MichelZ
Level 6
Partner Accredited Certified
Andrew

What happens if you set vaultItem.Content.Data to  "C:\Temp\Data.txt" ?
Does that work?

Cheers
Michel

cloudficient - EV Migration, creators of EVComplete.

AndrewB
Moderator
Moderator
Partner    VIP    Accredited
Thanks for the clarification Michel!