EDM212: Getting Started with the LF SDK

EDM212: Getting Started with the LF SDK

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 RepositoryRegistration myRepoReg = new RepositoryRegistration(localhost", LaserInvestigators"); Session mySess = new Session(); mySess.LogIn(myRepoReg); Console.WriteLine("Entry ID:"); //asks for entry ID int entryId = int.Parse(Console.ReadLine());

EntryInfo myEntry = Entry.GetEntryInfo(entryId, mySess); // get an entry Console.WriteLine(myEntry.Name); FieldValueCollection myFields = myEntry.GetFieldValues(); for (int i = 0; i < myFields.Count; i++) { Console.WriteLine(myFields.PositionToName(i) + ": " + myFields[i]); }

myEntry.Dispose(); //disposes of the object mySess.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 Youll use this frequently Logging In RepositoryRegistration myRepoReg = new

RepositoryRegistration("Server", "Repository"); Session mySess = new Session(); mySess.LogIn("username","password", myRepoReg); To use Windows authentication, do not pass username/password to the .LogIn() 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 EntryInfo object, use Document class to get DocumentInfo object, etc. Working with an Entry Object

EntryInfo myEntry = Entry.GetEntryInfo(entryId, mySess); Console.WriteLine(myEntry.Name); Other properties include: .Id, .Owner, .Path, .TemplateName

Getting Field Values Just like entries, there are objects that represent metadata FieldValueCollection myFields = myEntry.GetFieldValues(); for (int i = 0; i < myFields.Count; i++) {

Console.WriteLine(myFields.PositionToName(i) + ": " + myFields[i]); } Summary RepositoryRegistration myRepoReg = new RepositoryRegistration(localhost", LaserInvestigators"); Session mySess = new Session();

mySess.LogIn(myRepoReg); Console.WriteLine("Entry ID:"); //asks for entry ID int entryId = int.Parse(Console.ReadLine()); EntryInfo myEntry = Entry.GetEntryInfo(entryId, mySess); // get an entry Console.WriteLine(myEntry.Name); FieldValueCollection myFields = myEntry.GetFieldValues(); for (int i = 0; i < myFields.Count; i++)

{ Console.WriteLine(myFields.PositionToName(i) + ": " + myFields[i]); } myEntry.Dispose(); //disposes of the object mySess.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 mySearch = new Search(mySess); mySearch.Command = "{[]:[Investigator Assigned]=\"" + oldInvestigator +"\"}"; mySearch.Run(); Search Statistics

Create a SearchStatistics object to find useful information about your search Document/folder/page/shortcut count Text/image file size Search Statistics Code Example SearchStatistics searchStatistics =

mySearch.GetSummaryStats(); Console.WriteLine("Entries Found: " + searchStatistics.DocumentCount); Working with Search Results Create a SearchListingSettings object to specify the result data you want

Use .GetResultListing to create a SearchResultListing object Search Results Code Example SearchListingSettings settings = new SearchListingSettings(); SearchResultListing results =

mySearch.GetResultListing(settings); Working with Search Results Use SearchResultListing 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.RowsCount; k++) { int entryId = (int)results.GetDatum(k, SystemColumn.Id); Console.WriteLine(entryId + " " + results.GetDatumAsString(k, SystemColumn.Name));

EntryInfo myEntry = Entry.GetEntryInfo(entryId, mySess); FieldValueCollection myFields = myEntry.GetFieldValues(); myFields["Investigator Assigned"] = newInvestigator; myEntry.Lock(LockType.Exclusive); myEntry.SetFieldValues(myFields); myEntry.Save(); myEntry.Unlock();

myEntry.Dispose(); } Working with Search Results Code for (int k = 1; k <= results.RowsCount; k++) { int entryId = (int)results.GetDatum(k, SystemColumn.Id);

Console.WriteLine(entryId + " " + results.GetDatumAsString(k, SystemColumn.Name)); EntryInfo myEntry = Entry.GetEntryInfo(entryId, mySess); FieldValueCollection myFields = myEntry.GetFieldValues(); myFields["Name"] = name; myEntry.Lock(LockType.Exclusive); myEntry.SetFieldValues(myFields);

myEntry.Save(); myEntry.Unlock(); myEntry.Dispose(); } Locking and Saving Entries You must lock an entry before you modify it

Save your changes Locking and Saving Code Example myEntry.Lock(LockType.Exclusive); //lock the entry myEntry.SetFieldValues(myFields); //modify it myEntry.Save(); //save your changes

myEntry.Unlock(); //unlock the entry myEntry.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 EDM203: Effective Integration Strategies CD251: Using the Laserfiche UI in Your

Integration CC302: Capture and Classification with the SDK EDM351: Advanced Applied SDK Questions?

Further Learning EDM203: Effective Integration Strategies CD251: Using the Laserfiche UI in Your Integration CC302: Capture and Classification with the SDK EDM351: Advanced Applied SDK

Recently Viewed Presentations

  • Truth Tables - Asu

    Truth Tables - Asu

    (Since p has 2 values, and q has 2 value.) For p ^ q to be true, then both statements p, q, must be true. If either statement or if both statements are false, then the conjunction is false. p...
  • The Future of Identity in the Cloud: Requirements,

    The Future of Identity in the Cloud: Requirements,

    The Future of Identity in the Cloud: Requirements, Risks & Opportunities Marco Casassa Mont [email protected] HP Labs Systems Security Lab
  • Agenda November 4 - inetTeacher.com

    Agenda November 4 - inetTeacher.com

    Agenda November 3 Reading quiz Recitatif Discussion How does Morrison set up the story? How does she introduce you to time, space and the characters? How does Morrison use imagery to position time? Is this story told in present tense...
  • Poetic Forms

    Poetic Forms

    Devoted, On Guard. * SHAPE POETRY Poetry can take on many formats, but one of the most inventive forms is for the poem to take on the shape of its subject. Therefore, if the subject of your poem were of...
  • Cars and Tempe Center for the Guitars Arts

    Cars and Tempe Center for the Guitars Arts

    It has quadrilateral symmetry. This window has radial symmetry. The windows radiate out from one central point like the petals of a flower. Designers can balance elements in an unpredictable way, so you do not know what will be placed...
  • Accounting Principles, 4th Cdn Edition

    Accounting Principles, 4th Cdn Edition

    At Nike, accounting records show an ending inventory balance of $40 500 at the end of September and a physical inventory count indicates only $40 000. What is the adjusting entry? Cost of Goods Sold 500. ... Classified Balance Sheet.
  • Year 8 Quizzes

    Year 8 Quizzes

    Charles Booth. Seebohm Rowntree. Liberal. True. 15%. William Beveridge. Clement Atlee. 1948. Aneurin Bevan. Clean. Quiz 10: 19th & 20th Century Medicine Overview. 1) What did Wilhelm Rontgen discover that helped with surgery? 2) What major theory about the cause...
  • 2 1 / 2 0 C F A

    2 1 / 2 0 C F A

    A Safety Management Plan will be developed by the AAFC Senior Leadership Team in the first half of 2012 A Safety Management System will then be implemented during 2012 and will ensure compliance with the Work Health Safety Act. Training...