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

Question

Question

IMPORT Engine - Object reference not set to an instance of an object

SDK
asked on March 15, 2024

Hi using the SDK Import engine, I can happily import a file

 

C:\Temp\MyFIle.zip and give it metadata and mime etc, however if I try to use a mapped drive or Network drive I get the above error message.

 

\\MyDrive\Folder1\Folder2\MyFile.txt

of

Z:\MyFile.txt

 

Can anyone shed some light?

 

XML using

 

<LF:importengine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://laserfiche.com/namespaces/importengine ImportEngine.xsd"
                xmlns:LF="http://laserfiche.com/namespaces/importengine" version="1.0">
    <LF:toc on_document_conflict="unique" on_folder_conflict="unique">
        <LF:document name="Adam Richard Cooper World-Check" comment="Comment" language="" template="Client Document">
            <LF:metadata>
                <LF:field_values>
                    <LF:field_value name="Client NAME: DOCUMENT">The Derek Cooper 1994 Settlement - Closed</LF:field_value>
                    <!-- MANDATORY -->
                    <LF:field_value name="CLIENT ID: DOCUMENT">E1003194</LF:field_value>
                    <!-- MANDATORY -->
                    <LF:field_value name="CLIENT DOCUMENT TYPE">Compliance</LF:field_value>
                    <!-- MANDATORY -->
                    <LF:field_value name="CLIENT DOCUMENT SUB TYPE">Risk</LF:field_value>
                    <!-- MANDATORY -->
                    <LF:field_value name="DESCRIPTION">Adam Richard Cooper World-Check</LF:field_value>
                </LF:field_values>
            </LF:metadata>
            <LF:electronic_document content_type="application/msoutlook" extension="MSG">
                <LF:fileref ref="G:\Public\211018 Equiom Invoices.msg"/>
            </LF:electronic_document>
        </LF:document>
    </LF:toc>

</LF:importengine>

 

Bold line works if I use C:\, but not mapped drive!!!!

 

Thanks

0 0

Replies

replied on March 15, 2024

The Import Agent is a service and does not know about mapped drives.  Use the UNC path instead.  Also, make sure that the service runs as a domain account with permissions to the path.

replied on March 15, 2024

Try using UNC path instead of mapped drive.

0 0
replied on March 17, 2024

Hi thanks for that but that is the first thing that I had, still the same error.

0 0
replied on March 19, 2024

How do you run your program? Is it a console application?

0 0
replied on March 19, 2024

Hi, I run it from the samples as part of the SDK

The Import Util

0 0
replied on March 19, 2024

Can you paste the complete code here please?

0 0
replied on March 19, 2024

Hi, the code was not changed *with exception of the session info.

 

           string serverName = "**************", repoName = "***********";
           string username = "**********", password = "**************";

           /* You can find seven examples of XML list files to process at:
            * "..\\List File Examples\\Briefcase Example.xml";
            * "..\\List File Examples\\Electronic Document Example.xml";
            * "..\\List File Examples\\Folders Example.xml";
            * "..\\List File Examples\\Image and Text Example.xml";
            * "..\\List File Examples\\Image Example.xml";
            * "..\\List File Examples\\Multiple Electronic Document Example.xml";
            * "..\\List File Examples\\Template Population Example.xml"; */
           string listFilePath = @"C:\TEMP\KRB_TEST_mport.xml";

           try
           {
               // log into the repository
               RepositoryRegistration repository = new RepositoryRegistration(serverName, repoName);
               using (Session session = new Session())
               {
                   session.LogIn(username, password, repository);

                   // initialize an instance of ImportEngine
                   ImportEngine importEngine = new ImportEngine(session);
                   // configure import engine, the folder and volume to import
                   importEngine.RootPath = "\\KRB_SDK";
                   importEngine.VolumeName = "DEFAULT";
                   importEngine.IgnoreErrorAndContinue = true;

                   // begin importing
                   ImportOperation importOp = importEngine.BeginProcess(listFilePath);
                   // wait util the operation is complete, whether or not it is successful
                   while (!importOp.IsCompleted)
                   {
                       // print out the elapsed time and the current import phase
                       Console.WriteLine(importOp.ElapsedTime.ToString() + ":" + importOp.Phase.ToString());
                       // wait for 1 second, and then refresh the status
                       Thread.Sleep(1000);
                       importOp.Refresh();
                   }

                   // if there were any errors when importing, print them
                   if (importOp.HasFailed)
                       Console.WriteLine("Failure Reason:" + importOp.FailureReason.Message);
                   else if (importOp.AllLoggedExceptions != null && importOp.AllLoggedExceptions.Count > 0)
                   {
                       Console.WriteLine("Warning:");
                       foreach (ImportEngineException e in importOp.AllLoggedExceptions)
                           Console.WriteLine(e.Message);
                   }
                   else
                       Console.WriteLine("Success!");

                   // log out of the repository
                   session.LogOut();
               }
               Console.WriteLine("Done!");
           }
           catch (Exception ex)
           {
               Console.ForegroundColor = ConsoleColor.Red;
               Console.WriteLine(ex.Message);
           }

           Console.ResetColor();
           Console.WriteLine();
           Console.WriteLine("Hit enter to exit.");
           Console.ReadLine();

 

XML posted above, and C:\Temp works, but \\server\\location or (Mapped drive)\Location doesn't work thanks

0 0
replied on March 22, 2024

Hi, I have managed to get some data in, however, I tried 10,000 rows of which 3475 are imported.

 

Is there a limit on individual loads, as 0 errors, and 0 warnings, but 3475 out or 10,000??

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

Sign in to reply to this post.