You are viewing limited content. For full access, please sign in.

Question

Question

Using Visual Basic NET to search for documents

asked on March 19, 2014

Good Evening All,

 

I prefer to fish, rather than being given a fish, thus I am merely asking for some advice, thoughts and solid hints to point me in the right direction. I'm skilled with VB6 but have switched over to VB.net in the past year, so I'm having to re-learn this version of Visual Basic.

 

My client needs to be able to export searched (by selected date), files as pdf and tiff for delivery to their clients. I know its possible based on the SDK 7x and 8x code I'm seeing. The client is aware that this type of search and export will slow down systems during use, but must have the functionality.

 

I've been reading the source codes, and the developer sections, etc. I'm having issues getting the code to work in my Visual Studio 2010.It appears that the snippets were all designed in sdk 8 or older and many of the processes have changed, or else I am misreading them.

I have successfully built all of my program except for the search and export sections and this is where I am hitting a roadblock. I feel good about having figured out how to get the login to the repository to work properly.

 

My desired outcome is twofold.

 

1. Search the repository for any entry that has been created on a particular date range, or a single day. and output the data to the output console via the Console.WriteLine () (Later I will make it output to a xlsx file

 

2. Based on the list of entries, export copies of the documents to a physical folder on the local server.

 

Issues I'm seeing so far, the DB.GetEntryPath  ( see code in section 1 below from the SDK) keeps being seen as "not declared" even when I declare it  using my  code ( See section two). I'm also unsure what is going to be the best way to perform the search. From what I'm reading the code snippet should be looking in the statically assigned folder, but I'm not even getting the connection.

I'm willing to ignore the exprt function for another time as I want to thoroughly understand the HOW of the functionality and proper use.

 

Thanks in advance for any suggestions or ideas!

 

Brian

 

SECTION 1
' Retrieves a document.
Dim Doc As LFDocument = DB.GetEntryByPath("\Doc1")
' Indexes the document.
Doc.Index()
' Clears document handles.
Doc.Dispose()


SECTION 2 - Code under execute thus far

 Dim ServerName As String = TBServerName.Text, RepositoryName As String = TBRepositoryName.Text
        Dim UserName As String = TBLFRepoUserName.Text, UserPassword As String = TBLFRepoPassword.Text
        Dim myRegistration As New RepositoryRegistration(ServerName, RepositoryName)
        Dim mySession As New Session
        Dim searchstartdate As String = DateTimePicker1.Value
        Console.WriteLine(ServerName)
        Console.WriteLine(RepositoryName)
        Console.WriteLine(UserName)
        Console.WriteLine(UserPassword)
        mySession.LogIn(UserName, UserPassword, myRegistration)
       

        ' Retrieves a document.
        Dim Doc As LFDocument = Mysession.GetEntryByPath("\Doc1")
        ' Indexes the document.
        Doc.Index()
        ' Clears document handles.
        Doc.Dispose()
        

        'mySession.Close()
        'mySession = Nothing
        'myRegistration = Nothing

0 0

Answer

SELECTED ANSWER
replied on March 20, 2014 Show version history

Brian,

 

As Ben mentions; you are mixing code from the two distinctly different types of SDK libraries.  The first decision you need to make is which library to use; LFSO or RA.  LFSO (Laserfiche Server Objects) is COM based and the older of the two libraries.  RA (Repository Access) is .NET based and is the newer of the libraries.

 

There are advantages and disadvantages to both libraries.  The majority of the code examples in the SDK documentation are LFSO snippets so therefore the learning curve will be easier with LFSO.  On the other hand, RA is the new technology and at some point I assume will completely replace the LFSO libraries.

 

Personally, for any new project I use RA.

 

As you probably know, once you make a library selection then you need to add those references to your Visual Studio project.  If you choose LFSO you  will need to add references for the 'Interop.LFSO90Lib.dll' and the 'Interop.DocumentProcessor90.dll' (assuming you are using the 9.0 SDK.  You also need to select the libraries for the appropriate 'bitness', i.e. x86, x64).  The LFSO library will give you all of the functionality for the login and search and the DocumentProcessor library will give you access to the export functions.

 

If you choose RA then you will need to add references to the 'Laserfiche'RepositoryAccess.dll' and the 'Laserfiche.DocumentServices.dll'.  The RepositoryAccess library will give you access to login and search and the DocumentServices library will allow you to export a document.

 

It looks like you have a good handle on the steps necessary and are going to break them down by process to test them; i.e. 'Connect to the repository and log in', 'Search for specific documents', 'Step through the search results and export each document', etc.

 

If you need some help with the 'fishing' I am more than willing to help with specific code examples!  You can either PM me at cprimmer@qfiche.com or respond in this thread and I can post here.

 

Good luck!

 

1 0

Replies

replied on March 20, 2014 Show version history

Hi there,

 

From your sample code, I can see you're mixing COM object API calls with .Net API calls.

 

Here are some examples using the .Net libraries:

https://support.laserfiche.com/search/RecordClickHandler.ashx?url=https%3a%2f%2fsupport.laserfiche.com%2fGetFileRepositoryEntry.aspx%3fid%3d2925%26mode%3ddownload&sid=bf71666a-a5b8-4c5b-9c89-101e6a39e78b&rank=14

 

 

..And also the old forum:

https://support.laserfiche.com/forums.aspx?Link=viewtopic.php%3ft%3d18183%26amp

 

...and finally, there's the good ole search:

https://support.laserfiche.com/search/SearchWF.aspx?start=10&q=repositoryaccess+example&ptag=&tag=&bydate=false&type=&col=&lang=&dtstart=&dtend=

 

Edit:

I should probably add that in order to use either API from the SDK, you should be licensed. A licensed installation will include COM and .Net samples as well as the complete set of libraries, interops, documentation, access to Laserfiche support for development issues, merge modules and a runtime installer.

1 0
replied on March 20, 2014

Good Morning Ben and Cliff,

 

Thanks for the pointers. I will look over what you've posted and see what I can glean. I think for the expediency of future development for the client, I will go with the newer Dot NET based approach using RA. 

 

This will effectively put me in a new playing field, but no knowledge ever comes totally free or easy and I look forward to further conversations with you gentlemen. Cliff I appreciate the willingness to help me in my development of this project and if I get into a really tight spot I may well take you up on your offer to provide code assistance, but I think initially, for my own learning, I shall start by reading, then offer sacrifices of silicon wafer chips and cooling fan liquid to the Techno-Geek gods. :)

 

Have a wonderful day!

 

Best Regards,

Brian

1 0
replied on April 4, 2014

With a great deal of guidance and advice from Cliff, my project has completed evolution one. I wanted to give a heartfelt thanks to him, and you others who have advised me. I will be placing the source code up here once I finish cleaning it up. If anyone needs a copy of the code I would be more than happy to share, but the code has been developed in VB Studio 2013.

 

Regards,

Brian

1 0
replied on March 20, 2014

Ben,

 

How / what search engine are you using to find these items?  I've tried the one from the support site, and even Google and Bing and my keywords failed to pull up the ones you reference. Am I looking in the wrong area ? (apparently I think I am)

 

Regards,

Brian

0 0
replied on March 20, 2014 Show version history

Hi Brian,

 

The links should work when pasted into the browser but all searches were run from

 

http://support.laserfiche.com

 

(not answers.laserfiche.com)

 

If you don't have a license to develop with the Laserfiche SDK, those links might be blocked...

 

Also, the SDK is available in the Downloads section of the Laserfiche support site. Again, requires a license.

 

-Ben

 

Edit:

I should probably add, SDK access isn't part of the standard VAR kit.

 

0 0
replied on March 20, 2014

Only parts of the support site are public, so Google and Bing can only index those (KB articles mainly). White papers and the old forums are only searchable from the support site itself, and as Ben noted, SDK items are further secured based on whether the user owns the SDK or not.

0 0
replied on March 20, 2014 Show version history

Brian,

 

I will add that if you do not have access to the SDK you still might be able to accomplish your objective in Workflow.  If you go that route I would set the workflow up as a Business Process that the specified end-users can trigger.

 

If you do want to go that route we can have a conversation about it.  The tricky part would be getting the parameters (date ranges, etc) into the Business Process but there are a couple of ways I can think to do that.

 

FYI - Any SDK code can be used inside of a 'Workflow Script' activity or 'Workflow SDK Script' activity.  (The difference between the two is that the SDK Script activity already has the references included for interacting with Laserfiche entries.)

 

 

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.