Start a Conversation

Unsolved

This post is more than 5 years old

5714

April 5th, 2011 00:00

How to read from centera in c#

I am new to working with centera.  However I have managed to use documentation I found here http://www.adrdweb.com/centera/Article2.htm and I have been able to write to centera from an asp.net mvc web application. Unfortunately there is no further article showing how to read from the centera.  I have searched and searched and cannot find anything that can help.  Has anyone managed to read from centera using c#?  If they have can they help with some example code. Thanx.

409 Posts

April 5th, 2011 01:00

Hi

There is sample code in the SDK download for C and Java and if you have downloaded the .NET wrapper from

http://sourceforge.net/projects/cosi-dot-net/

there is sample code for C# VB etc

13 Posts

April 5th, 2011 01:00

Thanx Paul.

This looks like exactly what I needed.

I'll let you know.

13 Posts

April 6th, 2011 08:00

Thanks for your prompt response.

My problem is the files are not being written out to the working directory of the application.

I cannot see the files anywhere.

I have searched for the xml files but they are not anywhere.

If I could find out where they are being writtewn to I could then amend that and put them elsewhere.

My problem is I cannot find them but the log messages lead me to believe they are being created somewhere.

Am I correct in assuming the xml files are what I am looking for?

2 Intern

 • 

417 Posts

April 6th, 2011 08:00

They will likely be getting created where the .NET wrapper or Centera SDK files are located. But you should be specifically changing the filename in the code so that the output file is created in the directory where you want them stored. Then you would not need to guess!

The .XML file is the metadata file. You are probably more interested in your data, which are the x.Tag.y files.

2 Intern

 • 

417 Posts

April 6th, 2011 08:00

RetrieveContent is a simple example of how content can be read from a clip and written to the filesystem. All it does is iterate across the tags and writes the files out to the working directory of the application.

If you are looking to write the files into specific places (based on metadata you created) then you obviously need to modify the sample to read the metadata and create the output filename based on the metadata.

The code samples are just that - examples of how to use the basic methods to read and write content. You need to write your own code using your own specific application logic / requirements. The samples are purely there to guide you in how to work with the objects.

13 Posts

April 6th, 2011 08:00

Hi,

I have managed to use the 'RetreiveContent' sample code and I appear to be getting something back from the centera according to the logging -

The Blob has been stored into DUI61EMISI4P6e7IFRLRG26N47E.Tag.0 and The CDF has been saved to DUI61EMISI4P6e7IFRLRG26N47E.xml.  However I am not able to see where the files are.  They are image files and I am trying to write them to the directory structure but this is not working the directories are being written but the files are not.  Any help is much appreciated.

13 Posts

April 6th, 2011 23:00

Thanks.

I will look in those locations.

Once I can determine which files I am looking for i.e the image files (the x.Tag.y files ?) I can then put them in the correct location.

13 Posts

April 7th, 2011 05:00

Thanx for your help and prompt replies.

13 Posts

April 7th, 2011 05:00

Thanx for your help the clue to what the files where called helped x.Tag.y.

They were stored in the appserver folder as I am using visual studio 2010 on a local machine.

I am now able to read and write to Centera.

Thanx for your help and prompt replies

6 Posts

April 12th, 2011 13:00

Hi Graham,

I am working with the .NET sample solution to retrieve files from Centera. In the RetrieveContent project, as shown below, I am able to retrieve the files and I see the files are saved in the output path defined in the C# project properties, namely "bin\Debug\". I am wondering if I can specify the output path in the code to save the retrieved file elsewhere, for example, "C:\RetrievedFiles". In other word, is there a function parameter of which I can specify the output path. Or do I have to write my own code to copy the files and move to a desired location.

if (t.ToString() == "StoreContentObject")
{
String outfile = clipRef.ClipID + ".Tag." + 0;                  
FPStream streamRef = new FPStream(outfile, "wb");
                  
t.BlobRead(streamRef, FPMisc.OPTION_DEFAULT_OPTIONS);
streamRef.Close();
              
FPLogger.ConsoleMessage("\nThe Blob has been stored into " + outfile);
t.Close();
No Events found!

Top