Page 1 of 1

How to get the content of VaultClientFile?

Posted: Mon Dec 28, 2009 8:40 am
by siwachbit
I am creating a POC to Connect to Vault Server and Get All the files.
Put All the files in Database.

I have created a function RecursivelySearchForFileName()

I am able to get the VaultClientFile object, but not get the file content.

My client and server are on different locations.

I am using C# for developing this functionality.

Please help.

Re: How to get the content of VaultClientFile?

Posted: Mon Dec 28, 2009 9:52 am
by Beth
Can you post your code?

Re: How to get the content of VaultClientFile?

Posted: Mon Dec 28, 2009 10:24 am
by siwachbit
I am using this function to retrieve the list of files and folder of a particular folder

public void RecursivelySearch(VaultClientFolder folder, ref ArrayList returnArray, string folderUrl, VaultConnection vConn)
{
String url = folderUrl;
if (folder.Files.Count > 0)
{
//VaultRequestGetFile[] requests = null;
//string strDownloadID = "";
foreach (VaultClientFile subfile in folder.Files)
{
VaultFileProperties vFP = subfile.GetFileProperties();
//vConn.BeginDownloadFiles(Convert.ToInt32(subfile.ID), ref requests, ref strDownloadID);
//Ned here the content of file

returnArray.Add(subfile);
}
}
if (folder.Folders.Count > 0)
{
if (baseFolderUrl == "")
baseFolderUrl = ((VaultClientOperationsLib.VaultClientTreeObject)(folder)).FullPath;

foreach (VaultClientFolder subfolder in folder.Folders)
{
string folderPath = ((VaultClientOperationsLib.VaultClientTreeObject)(subfolder)).FullPath;
string finalFolder = folderPath.Replace(baseFolderUrl, url);
//Make entry in Database for this folder
RecursivelySearch(subfolder, ref returnArray, finalFolder, vConn);
}
}
}

string baseFolderUrl = "";

Re: How to get the content of VaultClientFile?

Posted: Tue Dec 29, 2009 8:28 am
by shannon
What version of Vault are you using?

Re: How to get the content of VaultClientFile?

Posted: Tue Dec 29, 2009 10:46 am
by siwachbit
I am using Vault 5.0.2

Re: How to get the content of VaultClientFile?

Posted: Tue Dec 29, 2009 11:09 am
by shannon
If you are using the ServerOperations class to connect and find your files, you can just call one of the methods in GetOperations to download the file. GetOperations.ProcessCommandGetToLocationOutsideWorkingFolder, for example, would probably work for your purposes. If you aren't using ServerOperations, you can look at the code inside the methods of the GetOperations class for examples of how to use the corresponding ClientInstance methods directly.

Give that a look and let us know if you have more questions.

Re: How to get the content of VaultClientFile?

Posted: Wed Dec 30, 2009 9:02 am
by siwachbit
Thanks Shannon.

Is there any way to get the stream/bytestream/byte[] of the file (without storing the file into Hard Drive).
Actually, within recursive method, if I found any file, I need the file stream at that moment and I will store that content in database.

Re: How to get the content of VaultClientFile?

Posted: Wed Dec 30, 2009 9:59 am
by shannon
Unfortunately no, you'll need to get it to disk and then stream it yourself from there.

Re: How to get the content of VaultClientFile?

Posted: Mon Jan 04, 2010 4:33 pm
by Beth
I'm moving this topic over to the API forum.