Hello everyone,
I'm using SDK Automation to create simple tool to launch scanning with specific options, I pass serialized connection string with scanoptions.ConnectionString parameter to LaunchScanning() on Laserfiche.ClientAutomation to use current connection instead of creating new one, but it doesn't work.
I don't get any errors when I use serialized connection but the scanning interface is not working, on the other hand when I use ServerName, RepositoryName, UserName and Password parameters it's working.
I tried debugging the code and the serialized connection string is being passed correctly.
Can any one help please?
- LF SDK Version: 9.2
- OS: Windows 8.1 single language
Below you find my code:
LFSO92Lib.LFDatabase lfdb; private void ButtonScan_Click(object sender, EventArgs e) { try { //--------------------- Laserfiche.ClientAutomation.ClientManager lfclient = new Laserfiche.ClientAutomation.ClientManager(); IList<int> selectedentries = (IList<int>)lfclient.GetAllSelectedEntries(); IEnumerable<ClientInstance> clients = lfclient.GetAllClientInstances(); string strSerializedConnection = ""; foreach (ClientInstance _client in clients) { IEnumerable<RepositoryConnection> repos = _client.RepositoryConnections; foreach (RepositoryConnection repo in repos) { if (lfdb == null) { // Retrieve the serialized connection string and use it to initialize the LFSO connection object strSerializedConnection = repo.GetConnectionString(); } } } LFSO92Lib.LFConnection lfsoconn = new LFConnection(); lfsoconn.CloneFromSerializedConnectionString(strSerializedConnection); lfdb = lfsoconn.Database; //--------------------- ILFDocument doc = new LFDocument(); LFFolder path = (LFFolder)lfdb.GetEntryByPath("Demo\\Backlog"); LFVolume vol = (LFVolume)lfdb.GetVolumeByName("DEFAULT"); doc.Create(TextBoxPatientNumber.Text, path, vol, true); string serializedconn = strSerializedConnection; //string servername = "localhost"; //string repository = "Demo"; //string username = "lfadmin"; //string password = "123"; //bool usessl = false; //int folderid = 0; int documentid = doc.ID; int insertat = 0; // -3 = Default, -2 = Ask, -1 = End, 0 = Beginning bool waitforclose = false; bool closeafterstoring = true; ScanMode scanmode = ScanMode.Standard; //--- lfsoconn.Terminate(); // To unlock the document after creation //--- ScanOptions scanoptions = new ScanOptions(); scanoptions.ConnectionString = strSerializedConnection; //scanoptions.ServerName = servername; //scanoptions.RepositoryName = repository; //scanoptions.UserName = username; //scanoptions.Password = password; //scanoptions.IsSecureConnection = usessl; scanoptions.WaitForExit = waitforclose; scanoptions.CloseAfterStoring = closeafterstoring; scanoptions.ScanMode = scanmode; scanoptions.EntryId = documentid; scanoptions.IsDocument = true; scanoptions.InsertPagesAt = insertat; lfclient.LaunchScanning(scanoptions); } catch (Exception exc) { MessageBox.Show(exc.Message); } }