Getting Started with the Laserfiche SDK Agenda SDK






















































- Slides: 54
Getting Started with the Laserfiche SDK
Agenda ‣ ‣ SDK overview Demo What you need to know to get started Where to go from here
Prerequisites ‣ Knowledge of Laserfiche architecture ‣ Some programming experience
What is the SDK? ‣ Tools you can use to create custom applications that access Laserfiche • Libraries • Distribution tools • Documentation
What Can You Do with the SDK? ‣ Create applications that work with… • The repository • Documents • The Laserfiche Client user interface
SDK Libraries
SDK Libraries ‣. NET • Repository Access • Document Services • Client Automation Tools ‣ COM, Java libraries available
Repository Access ‣ ‣ Connections Metadata Entries Administration
Document Services ‣ Import/Export documents ‣ Generate text
Client Automation Tools ‣ Control UI ‣ Scan ‣ Integrate Laserfiche and other applications
Quick Demo!
Demo Overview ‣ ‣ ‣ Logging in and out Working with entries Modifying field values Locking and saving Searching
Basic Demo Recap ‣ Returned name and field values for an entry
Behind the Scenes ‣ Logged in ‣ Found an entry • Found its field information ‣ Logged out
Demo Code Repository. Registration my. Repo. Reg = new Repository. Registration(“localhost", “Laser. Investigators"); Session my. Sess = new Session(); my. Sess. Log. In(my. Repo. Reg); Console. Write. Line("Entry ID: "); //asks for entry ID int entry. Id = int. Parse(Console. Read. Line()); Entry. Info my. Entry = Entry. Get. Entry. Info(entry. Id, my. Sess); // get an entry Console. Write. Line(my. Entry. Name); Field. Value. Collection my. Fields = my. Entry. Get. Field. Values(); for (int i = 0; i < my. Fields. Count; i++) { Console. Write. Line(my. Fields. Position. To. Name(i) + ": " + my. Fields[i]); } my. Entry. Dispose(); //disposes of the object my. Sess. Close(); //logs out and disconnects from Laserfiche
Common SDK Tasks
SDK Building 101 ‣ ‣ ‣ Log in Lock the documents to be worked on Perform the actions Save the changes Release the locks Log out
Logging In ‣ Create a Session() object • Windows or Laserfiche authentication • Can use SSL • You’ll use this frequently
Logging In Repository. Registration my. Repo. Reg = new Repository. Registration("Server", "Repository"); Session my. Sess = new Session(); my. Sess. Log. In("username", "password", my. Repo. Reg); ‣ To use Windows authentication, do not pass username/password to the. Log. In() method
After Logging In… ‣ Work with • • Templates Users Entries And more
Working with Entries ‣ Use a static class to create an info object • Many methods available ‣ Use Entry class to get Entry. Info object, use Document class to get Document. Info object, etc.
Working with an Entry Object Entry. Info my. Entry = Entry. Get. Entry. Info(entry. Id, my. Sess); Console. Write. Line(my. Entry. Name); Other properties include: ‣. Id, . Owner, . Path, . Template. Name
Getting Field Values ‣ Just like entries, there are objects that represent metadata Field. Value. Collection my. Fields = my. Entry. Get. Field. Values(); for (int i = 0; i < my. Fields. Count; i++) { Console. Write. Line(my. Fields. Position. To. Name(i) + ": " + my. Fields[i]); }
Summary Repository. Registration my. Repo. Reg = new Repository. Registration(“localhost", “Laser. Investigators"); Session my. Sess = new Session(); my. Sess. Log. In(my. Repo. Reg); Console. Write. Line("Entry ID: "); //asks for entry ID int entry. Id = int. Parse(Console. Read. Line()); Entry. Info my. Entry = Entry. Get. Entry. Info(entry. Id, my. Sess); // get an entry Console. Write. Line(my. Entry. Name); Field. Value. Collection my. Fields = my. Entry. Get. Field. Values(); for (int i = 0; i < my. Fields. Count; i++) { Console. Write. Line(my. Fields. Position. To. Name(i) + ": " + my. Fields[i]); } my. Entry. Dispose(); //disposes of the object my. Sess. Close(); //logs out and disconnects from Laserfiche
Searching Demo Overview
Searching Demo Overview ‣ Searched for an entry by its name ‣ For each result, updated a field with a value we specified
Behind the Scenes ‣ Logged in ‣ Searched for entries by name ‣ For each entry found • • Locked the entry Added a value for the name field Saved the changes Unlocked the entry ‣ Logged out
Searching ‣ Create a Search object ‣ Use advanced search syntax with the. Command property ‣ Use the. Run method to begin the search
Searching Code Example Search my. Search = new Search(my. Sess); my. Search. Command = "{[]: [Investigator Assigned]="" + old. Investigator +""}"; my. Search. Run();
Search Statistics ‣ Create a Search. Statistics object to find useful information about your search • Document/folder/page/shortcut count • Text/image file size
Search Statistics Code Example Search. Statistics search. Statistics = my. Search. Get. Summary. Stats(); Console. Write. Line("Entries Found: " + search. Statistics. Document. Count);
Working with Search Results ‣ Create a Search. Listing. Settings object to specify the result data you want ‣ Use. Get. Result. Listing to create a Search. Result. Listing object
Search Results Code Example Search. Listing. Settings settings = new Search. Listing. Settings(); Search. Result. Listing results = my. Search. Get. Result. Listing(settings);
Working with Search Results ‣ Use Search. Result. Listing to find the information you want ‣ Sample app iterated through each result and modified the entry
Working with Search Results Code for (int k = 1; k <= results. Rows. Count; k++) { int entry. Id = (int)results. Get. Datum(k, System. Column. Id); Console. Write. Line(entry. Id + " " + results. Get. Datum. As. String(k, System. Column. Name)); Entry. Info my. Entry = Entry. Get. Entry. Info(entry. Id, my. Sess); Field. Value. Collection my. Fields = my. Entry. Get. Field. Values(); my. Fields["Investigator Assigned"] = new. Investigator; my. Entry. Lock(Lock. Type. Exclusive); my. Entry. Set. Field. Values(my. Fields); my. Entry. Save(); my. Entry. Unlock(); my. Entry. Dispose(); }
Working with Search Results Code for (int k = 1; k <= results. Rows. Count; k++) { int entry. Id = (int)results. Get. Datum(k, System. Column. Id); Console. Write. Line(entry. Id + " " + results. Get. Datum. As. String(k, System. Column. Name)); Entry. Info my. Entry = Entry. Get. Entry. Info(entry. Id, my. Sess); Field. Value. Collection my. Fields = my. Entry. Get. Field. Values(); my. Fields["Name"] = name; my. Entry. Lock(Lock. Type. Exclusive); my. Entry. Set. Field. Values(my. Fields); my. Entry. Save(); my. Entry. Unlock(); my. Entry. Dispose(); }
Locking and Saving Entries ‣ You must lock an entry before you modify it ‣ Save your changes
Locking and Saving Code Example my. Entry. Lock(Lock. Type. Exclusive); //lock the entry my. Entry. Set. Field. Values(my. Fields); //modify it my. Entry. Save(); //save your changes my. Entry. Unlock(); //unlock the entry my. Entry. Dispose(); //get rid of the entry object
Summary
Write Robust Code ‣ These sample apps work in a perfect environment ‣ Use try-catch statements to handle the unexpected
Deployment!
Distribution Tools ‣ Run-time installer ‣ Merge modules
Run-Time Installer ‣ Use the installer that comes with the SDK, then copy your application over
Merge Modules ‣ Used with your installer to deliver only the components you need
Resources!
Resources ‣ SDK Documentation • Tutorials • Sample projects • Object references ‣ Legacy SDK libraries
More Resources ‣ Solution Exchange ‣ Support Site • Code Library • Answers Site
Solution Exchange
Support Site
Code Library
Answers
Further Learning ‣ EDM 203: Effective Integration Strategies ‣ CD 251: Using the Laserfiche UI in Your Integration ‣ CC 302: Capture and Classification with the SDK ‣ EDM 351: Advanced Applied SDK
Questions?
Further Learning ‣ EDM 203: Effective Integration Strategies ‣ CD 251: Using the Laserfiche UI in Your Integration ‣ CC 302: Capture and Classification with the SDK ‣ EDM 351: Advanced Applied SDK