Adding a custom information

Discussions concerning general integration topics.

Moderator: Phil Barton

Post Reply
muhsmann
Posts: 54
Joined: Thu Jan 15, 2009 5:41 pm

Adding a custom information

Post by muhsmann »

I have replaced the default document storage functionality in SoftPro. We are integrating w/ another document storage application and along w/ SP we'll have several other apps using the same repository. Document identification will become an issue. In our current design we have a common portal that all 'outside' document systems, like SP, will have to use to permanently store documents in the common repository. This portal, a web service, will generate an identifier for all documents that are deposited into the repository. I need to capture this global identifier in my implementation of IDocumentStorage.SaveDocument and store it for future reference.
My thinking is that I could maybe use a custom field - but I don't see that functionality on IDocumentImage. However, it appears on many of the other interfaces.
There is a possibility that I'll need other information that I need to store related to a document that I push to our common repository. So maybe instead of just one custom field I might need a custom table in the database - I'm not sure what the support for that is - keeping in mind the SP users would never need access to the new table. Can I get the database connection string from SelectServer? If I can then I can take responsibility of maintaining the table myself. I could of course store the connection string in my assembly but I would rather get it from the application.
Mark McKenna

Re: Adding a custom information

Post by Mark McKenna »

Your SaveDocument method is required to return a Uri to our system. It can be anything you want as long as its valid and meaningful to you. This Uri serves as your unique identifier so unless I'm misunderstanding your question, you shouldn't need to store the identifying data elsewhere. We store that Uri in the database alongside the Order to which the document was attached. For example, say that your SaveDocument method executes and is handed the temporary location of a particular PDF file that you wish to store. You would push that document through your portal and be handed back the unique identifier that the repository generated (let's say it's a random guid). Using that identifier then, you would construct a meaningful Uri and return that from SaveDocument. Perhaps something like this:

Code: Select all

public Uri SaveDocument( IDocumentStorageItem document )
{
    string filePath = document.OriginalLocation.LocalPath;
    Guid id = MyDMS.Store( filepath );
    return id != Guid.Empty ? new Uri( String.Format( @"MyDMS://{0}", id.ToString( "N" ) ) ) : null;
}
This same Uri is fed to the IDocumentStorage.LoadDocument method so you would simply reverse the process to find the correct document in your DMS. Note that if you have multiple points of data to store, you could leverage the query information component of the Uri. Again, as long as the Uri is valid and meaningful to you, it'll work.
Post Reply