private void CreateInstance()
        {
            if (this.instance != null)
            {
                return;
            }

            if (this.connectionInfo.UseRsaBearerToken)
            {
#if WRAPPER_SDK
                this.instance = ImportAPI.CreateByRsaBearerToken(this.connectionInfo.WebServiceUrl);
#else
                throw new NotSupportedException("This version of Import API doesn't support RSA bearer token authentication.");
#endif
            }
            else if (!string.IsNullOrEmpty(this.connectionInfo.UserName) &&
                     !string.IsNullOrEmpty(this.connectionInfo.Password))
            {
                this.instance = new ImportAPI(this.connectionInfo.UserName, this.connectionInfo.Password, this.connectionInfo.WebServiceUrl);
            }
            else
            {
#if WRAPPER_SDK
                throw new NotSupportedException("This version of Import API doesn't support integrated security authentication.");
#else
                this.instance = new ImportAPI(this.connectionInfo.WebServiceUrl);
#endif
            }
        }
        public bool ImportDocument(IAgentHelper helper, int workspaceID, List <WikitivityUploadsAgent.DataObtainedSingleRequestObject> batchedArticleList, AgentBase aB)
        {
            var success = false;

            Int32  workspaceArtifactID     = workspaceID;
            Int32  identifyFieldArtifactID = 1003667;               // 'Control Number' Field
            String relativityWebAPIUrl     = GetWebApiUrl(helper, aB);

            aB.RaiseMessage("Obtained RelativityWebAPI: " + relativityWebAPIUrl, 1);
            String    relativityFolderName = "Name of the Destination Folder";
            var       url  = relativityWebAPIUrl;
            ImportAPI iapi = ImportAPI.CreateByRsaBearerToken(url);

            try
            {
                var importJob = iapi.NewNativeDocumentImportJob();
                importJob.OnMessage              += ImportJobOnMessage;
                importJob.OnComplete             += ImportJobOnComplete;
                importJob.OnFatalException       += ImportJobOnFatalException;
                importJob.Settings.CaseArtifactId = workspaceArtifactID;
                importJob.Settings.ExtractedTextFieldContainsFilePath = false;

                // Utilize these fields to set up native import
                // importJob.Settings.DisableNativeLocationValidation = true; Use these two lines for disabling native import & validation.
                // importJob.Settings.DisableNativeValidation = true;
                // importJob.Settings.NativeFilePathSourceFieldName = "Original Folder Path";
                importJob.Settings.NativeFileCopyMode = NativeFileCopyModeEnum.DoNotImportNativeFiles;                 // NativeFileCopyModeEnum.CopyFiles; NativeFileCopyModeEnum.DoNotImportNativeFiles
                importJob.Settings.OverwriteMode      = OverwriteModeEnum.Append;
                importJob.Settings.IdentityFieldId    = identifyFieldArtifactID;
                importJob.SourceData.SourceData       = GetDocumentDataTable(batchedArticleList, aB).CreateDataReader();

                importJob.Execute();

                success = true;
            }
            catch (Exception ex)
            {
                aB.RaiseMessage(ex.ToString(), 1);
            }
            return(success);
        }