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

Question

Question

Writing My First SDK Program

asked on August 30, 2023

Hello

I'm trying to replicate the sample code for an SDK integration that comes in the documentation in visual, but when I check the repository it doesn't do anything and doesn't show any errors either, do you know how I can test that is logged in? And if is creat a document?

0 0

Replies

replied on August 31, 2023

1.) What programing language are you using?
2.) Which SDK example are you trying to use?
3.) If you run the program through the debugger and step through it, does it hit any errors (handled by try - catch)?

0 0
replied on August 31, 2023

The language is c# and the example is the same as the title: How to write your first SDK program.


The debugger gives me the following output:


PrimerProgSDK.exe' (CLR v4.0.30319: DefaultDomain): 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' loaded. Skipped loading symbols. The module is optimized and the 'Just my code' debugger option is enabled.
'PrimerProgSDK.exe' (CLR v4.0.30319: DefaultDomain): 'C:\Users\Soporte01\source\repos\PrimerProgSDK\PrimerProgSDK\bin\Debug\PrimerProgSDK.exe' loaded. Symbols charged.
'PrimerProgSDK.exe' (CLR v4.0.30319: PrimerProgSDK.exe): 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Laserfiche.RepositoryAccess\v4.0_10.2.0.0__3f98b3eaee6c16a6\Laserfiche.RepositoryAccess.dll' loaded. Skipped loading symbols. The module is optimized and the 'Just my code' debugger option is enabled.
'PrimerProgSDK.exe' (CLR v4.0.30319: PrimerProgSDK.exe): 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' loaded. Skipped loading symbols. The module is optimized and the 'Just my code' debugger option is enabled.
'PrimerProgSDK.exe' (CLR v4.0.30319: PrimerProgSDK.exe): 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Laserfiche.HttpClient\v4.0_10.2.0.0__3f98b3eaee6c16a6\Laserfiche.HttpClient.dll' loaded. Skipped loading symbols. The module is optimized and the 'Just my code' debugger option is enabled.
'PrimerProgSDK.exe' (CLR v4.0.30319: PrimerProgSDK.exe): 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' loaded. Skipped loading symbols. The module is optimized and the 'Just my code' debugger option is enabled.
'PrimerProgSDK.exe' (CLR v4.0.30319: PrimerProgSDK.exe): 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' loaded. Skipped loading symbols. The module is optimized and the 'Just my code' debugger option is enabled.
'PrimerProgSDK.exe' (CLR v4.0.30319: PrimerProgSDK.exe): 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Laserfiche.RepositoryAccess.resources\v4.0_10.2.0.0_en_3f98b3eaee6c16a6\Laserfiche.RepositoryAccess.resources. dll' loaded. The module was compiled without symbols.
Exception thrown: 'Laserfiche.RepositoryAccess.ObjectNotFoundException' in Laserfiche.RepositoryAccess.dll
'PrimerProgSDK.exe' (CLR v4.0.30319: PrimerProgSDK.exe): 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_en_b77a5c561934e089\mscorlib.resources.dll' loaded. The module was compiled without symbols.
The program '[22108] PrimerProgSDK.exe' terminated with code 0 (0x0).

0 0
replied on August 31, 2023 Show version history

Did you change the field and template to something that is in your repository?

Did you change the path for the document to one that exists?

Also, comment out the .Lock statement since the document is still locked by the using statement

        static void Main(string[] args)
        {
            try
            {
                using (Session mySession = new Session())
                {
                    RepositoryRegistration myRepoReg = new RepositoryRegistration("myLFServer", "myRepo");
                    mySession.LogIn("myUsername", "myPassword", myRepoReg);
                    Console.Write("Compruebe la consola de administración de LF para verificar que ha iniciado sesión y, a continuación" + Environment.NewLine + "Pulse cualquier tecla para continuar...");
                    Console.ReadKey(true);
                    using (DocumentInfo myDoc = new DocumentInfo(mySession))
                    {
                        myDoc.Create("\\newDoc", "default", EntryNameOption.AutoRename);
                        FieldValueCollection FVC = new FieldValueCollection();
                        //myDoc.Lock(LockType.Exclusive);
                        FVC.Add("Subject", "Testing SDK");
                        myDoc.SetTemplate("General", FVC);
                        myDoc.Save();
                        Console.Write(Environment.NewLine + "Por favor, busque EntryID en su repositorio " + myDoc.Id.ToString());
                        Console.Write(Environment.NewLine + "Presione cualquier tecla para continuar");
                        Console.ReadKey(true);
                    }
                }
            }  catch (Exception ex)
            {
                Console.Write(ex.Message);
                Console.Write(Environment.NewLine + "Presione cualquier tecla para continuar");
                Console.ReadKey(true);
            }
        }

 

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

Sign in to reply to this post.