/// <summary>
        /// This function shows how to checkin a document using encryption functionality of
        /// </summary>
        /// <param name="ix"></param>
        /// <param name="CONST"></param>
        /// <param name="ci"></param>
        /// <returns></returns>
        private string checkinDocEncrypted(IXConnection ix, IXServicePortC CONST)
        {
            // Tell IndexServer to encrypt/decrypt.
            setSessionOptionEncrypt(ix, true);

            // Provide external password of encryption set.
            // This password must be encrpyted for security reasons.
            // Administrators should not know it!
            string encrPwd = ix.EncryptPassword(encryptionPassword);

            ix.Ix.provideCryptPassword("" + encryptionSet, encrPwd);

            // Create document
            EditInfo ed = ix.Ix.createDoc("1", "0", null, EditInfoC.mbSordDoc);

            ed.sord.name = "C# example CheckinOutDocEncrypted";
            ed.sord.details.encryptionSet = encryptionSet;

            // Create file for document version
            String testFile = internalCreateTestFile("CheckinDocEncrypted example file", "txt");

            // Supply the extension of the document
            ed.document.docs                  = new DocVersion[1];
            ed.document.docs[0]               = new DocVersion();
            ed.document.docs[0].ext           = ix.GetFileExt(testFile);
            ed.document.docs[0].pathId        = ed.sord.path;
            ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;

            // CheckinDocBegin: let IndexServer generate an URL to upload the document
            // This URL addresses always the IndexServer and not the Document Manager.
            ed.document = ix.Ix.checkinDocBegin(ed.document);

            // -------------------------------------------------------------------------------
            // The URL to upload the document should be a HTTPS URL in production environments!
            // IndexServer configuration option "ixUrlBase" might be helpful here.
            // -------------------------------------------------------------------------------

            Logger.instance().log("prepared upload URL=" + ed.document.docs[0].url + ", doc-guid=" + ed.document.docs[0].guid);

            // Upload document version.
            // IndexServer encrypts the document.
            ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, testFile);
            Logger.instance().log("upload document version succeeded");

            // CheckinDocEnd: uploadResult contains the document information from ELODM.
            // Pass this information to
            ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);
            Logger.instance().log("inserted document:");
            Logger.instance().log("  objId=" + ed.document.objId);
            Logger.instance().log("  docId=" + ed.document.docs[0].id);
            Logger.instance().log("  doc-guid=" + ed.document.docs[0].guid);
            Logger.instance().log("  URL=" + ed.document.docs[0].url);

            System.IO.File.Delete(testFile);

            return(ed.document.objId);
        }
示例#2
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // Create a document
                EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc);
                ed.sord.name     = "document with sticky notes";
                ed.document      = new Document();
                ed.document.docs = new DocVersion[1] {
                    new DocVersion()
                };
                ed.document.docs[0].ext           = "tif";
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF");
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);

                Note[] notes = new Note[3];

                // Create a normal sticky note
                notes[0]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_NORMAL, null);
                notes[0].desc = "This is a normal sticky note";

                // Create a personal note
                notes[1]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_PERSONAL, null);
                notes[1].desc = "This is a personal note";

                // Create a stamp note
                notes[2]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_STAMP, null);
                notes[2].desc = "This is a stamp note";

                int[] noteIds = ix.Ix.checkinNotes(null, notes, NoteC.mbAll, LockC.NO);
                Logger.instance().log("noteIds=" + noteIds);
            }
            finally
            {
                ix.Logout();
            }
        }
示例#3
0
        static void createDocument(string file, string actFolder)
        {
            Document doc = new Document();
            //Step 1
            EditInfo ed   = conn.Ix.createDoc(actFolder, "", null, EditInfoC.mbSordDocAtt);
            Sord     sord = ed.sord;

            sord.name     = nameItem(file);
            sord.IDateIso = DateTime.Now.ToString("u");
            //Step 2
            doc.docs                  = new DocVersion[] { new DocVersion() };
            doc.docs[0].pathId        = sord.path;
            doc.docs[0].encryptionSet = sord.details.encryptionSet;
            doc.docs[0].ext           = conn.GetFileExt(file);
            doc = conn.Ix.checkinDocBegin(doc);
            // Step 3
            doc.docs[0].uploadResult = conn.Upload(doc.docs[0].url, file);
            // Step 4
            doc = conn.Ix.checkinDocEnd(sord, SordC.mbAll, doc, LockC.NO);
        }
示例#4
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // Create a document
                EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc);
                ed.sord.name     = "document with annotations";
                ed.document      = new Document();
                ed.document.docs = new DocVersion[1] {
                    new DocVersion()
                };
                ed.document.docs[0].ext           = "tif";
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF");
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);

                List <Note> notes = new List <Note>();

                // -------------------------------------------------------
                // Do not use the member Note.desc for annotations because
                // it contains position and formatting information.
                // -------------------------------------------------------

                // Text on a opaque rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_NOTE_WITHFONT, null);
                    note.noteText.text = "This is an annotation with font=" + note.noteText.fontInfo.faceName;

                    note.color = NetColorToEloColor(System.Drawing.Color.RosyBrown);
                    note.noteText.fontInfo.height *= 2;
                    note.noteText.fontInfo.bold    = true;
                    note.noteText.fontInfo.italic  = true;
                    note.noteText.fontInfo.RGB     = NetColorToEloColor(System.Drawing.Color.SkyBlue);

                    note.XPos   = 100;
                    note.YPos   = 200;
                    note.width  = 1000;
                    note.height = 500;

                    notes.Add(note);
                }

                // Horizontal line
                if (true)
                {
                    Note      note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_HORIZONTAL_LINE, null);
                    PointInfo p1   = new PointInfo();
                    p1.x = 100;
                    p1.y = 750;
                    PointInfo p2 = new PointInfo();
                    p2.x = p1.x + 900;
                    p2.y = p1.y;
                    note.noteFreehand.points = new PointInfo[] { p1, p2 };

                    note.noteFreehand.width = 20; // Pen width

                    note.color = NetColorToEloColor(System.Drawing.Color.Violet);

                    notes.Add(note);
                }

                // Freehand line (this example draws a circle)
                if (true)
                {
                    Note             note   = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_FREEHAND, null);
                    List <PointInfo> points = new List <PointInfo>();
                    for (int i = 0; i < 360; i += 5)
                    {
                        double    alpha = 2 * Math.PI * (double)i / 360.0;
                        PointInfo p     = new PointInfo();
                        p.x = 200 + (int)(Math.Sin(alpha) * 100);
                        p.y = 900 + (int)(Math.Cos(alpha) * 100);
                        points.Add(p);
                    }
                    note.noteFreehand.points = points.ToArray();

                    note.noteFreehand.width = 50; // Pen width

                    note.color = NetColorToEloColor(System.Drawing.Color.Tomato);

                    notes.Add(note);
                }

                // Draws a half-transparent rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_MARKER, null);
                    note.XPos   = 400;
                    note.YPos   = 800;
                    note.width  = 300;
                    note.height = 200;
                    note.color  = NetColorToEloColor(System.Drawing.Color.YellowGreen);

                    notes.Add(note);
                }

                // Draws a filled (opaque) rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_FILLEDRECTANGLE, null);
                    note.XPos   = 800;
                    note.YPos   = 800;
                    note.width  = 300;
                    note.height = 200;
                    note.color  = NetColorToEloColor(System.Drawing.Color.YellowGreen);

                    notes.Add(note);
                }

                // Draws a strikeout line
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_STRIKEOUT, null);

                    PointInfo p1 = new PointInfo();
                    p1.x = 100;
                    p1.y = 1100;
                    PointInfo p2 = new PointInfo();
                    p2.x = p1.x + 900;
                    p2.y = p1.y;
                    note.noteFreehand.points = new PointInfo[] { p1, p2 };

                    note.noteFreehand.width          = 100;
                    note.noteFreehand.strikeoutWidth = 20;
                    note.noteFreehand.strikeoutColor = NetColorToEloColor(System.Drawing.Color.Red);

                    note.color = NetColorToEloColor(System.Drawing.Color.Yellow);

                    notes.Add(note);
                }


                int[] noteIds = ix.Ix.checkinNotes(null, notes.ToArray(), NoteC.mbAll, LockC.NO);
                Logger.instance().log("noteIds=" + noteIds);
            }
            finally
            {
                ix.Logout();
            }
        }
示例#5
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // 1. Create sord for document without version

                // Initialize Sord object
                EditInfo ed = ix.Ix.createDoc("1", "0", null, EditInfoC.mbSordDocAtt);
                ed.sord.name = "C# example CheckinAttachment";

                // Create attachment file
                String attFile = internalCreateTestFile("CheckinNewAttachment attachment file", "txt");

                // Supply the extension of the document
                ed.document.atts           = new DocVersion[1];
                ed.document.atts[0]        = new DocVersion();
                ed.document.atts[0].ext    = ix.GetFileExt(attFile);
                ed.document.atts[0].pathId = ed.sord.path;
                // ed.document.atts[0].encryptionSet = ignored

                // CheckinDocBegin: let IndexServer generate an URL to upload the document
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                Logger.instance().log("prepared upload URL=" + ed.document.atts[0].url + ", att-guid=" + ed.document.atts[0].guid);

                // Upload the document
                String uploadResult = ix.Upload(ed.document.atts[0].url, attFile);
                ed.document.atts[0].uploadResult = uploadResult;
                Logger.instance().log("upload succeeded");
                System.IO.File.Delete(attFile);

                // CheckinDocEnd: uploadResult contains the document information from ELODM.
                // Pass this information to
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);
                Logger.instance().log("inserted document:");
                Logger.instance().log("  objId=" + ed.document.objId);
                Logger.instance().log("  attId=" + ed.document.atts[0].id);
                Logger.instance().log("  att-guid=" + ed.document.atts[0].guid);
                Logger.instance().log("  URL=" + ed.document.atts[0].url);

                // 2. Checkout and show document
                ed = ix.Ix.checkoutDoc(ed.sord.guid, null, EditInfoC.mbAll, LockC.NO);
                String tempName2 = internalMakeTempFileName(ed.document.atts[0].ext);
                ix.Download(ed.document.atts[0].url, tempName2);

                // Uncomment this to show document in notepad:
                // System.Diagnostics.Process.Start("notepad.exe", tempName2);
                // System.Threading.Thread.Sleep(3000);

                System.IO.File.Delete(tempName2);

                bool cleanUp = true;
                if (cleanUp)
                {
                    // Delete Document
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, null);
                    ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
示例#6
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Create a root folder
                Sord e1 = ix.Ix.createSord("1", "0", EditInfoC.mbSord).sord;
                e1.name = "e1";
                e1.id   = ix.Ix.checkinSord(e1, SordC.mbAll, LockC.NO);
                Logger.instance().log("created e1: id=" + e1.id);

                // Create 100 Sords
                String[] guids = new String[nbOfDocs];

                long diffTicks = 0;
                for (int i = 0; i < nbOfDocs; i++)
                {
                    // Initialize a EditInfo object
                    long     t1 = System.DateTime.Now.Ticks;
                    EditInfo ed = ix.Ix.createDoc(e1.guid, "Email", null, EditInfoC.mbSordDocAtt);
                    long     t2 = System.DateTime.Now.Ticks;
                    diffTicks += (t2 - t1);

                    // Add some index attributes
                    ed.sord.name = "e1." + i;
                    for (int idx = 0; idx < ed.sord.objKeys.Length; idx++)
                    {
                        ed.sord.objKeys[idx].data = new String[] { ed.sord.name + ".idx" + idx };
                    }

                    // Create a file
                    String docFile = internalCreateTestFile("DocPerformance " + ed.sord.name, "txt");

                    // checkinDocBegin
                    ed.document.docs                  = new DocVersion[1];
                    ed.document.docs[0]               = new DocVersion();
                    ed.document.docs[0].ext           = ix.GetFileExt(docFile);
                    ed.document.docs[0].pathId        = ed.sord.path;
                    ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                    ed.document = ix.Ix.checkinDocBegin(ed.document);

                    // upload
                    t1 = System.DateTime.Now.Ticks;
                    ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, docFile);
                    t2         = System.DateTime.Now.Ticks;
                    diffTicks += (t2 - t1);

                    // checkinDocEnd
                    t1          = System.DateTime.Now.Ticks;
                    ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);
                    t2          = System.DateTime.Now.Ticks;
                    diffTicks  += (t2 - t1);

                    guids[i] = ed.sord.guid;
                    if ((i + 1) % 20 == 0)
                    {
                        Logger.instance().log("create: " + (i + 1) + "/" + nbOfDocs);
                    }

                    System.IO.File.Delete(docFile);
                }

                // Log time values
                logTimeValues("create", diffTicks, nbOfDocs);

                // 2. Read 100 Documents
                diffTicks = 0;
                for (int i = 0; i < nbOfDocs; i++)
                {
                    // checkoutDoc
                    long     t1 = System.DateTime.Now.Ticks;
                    EditInfo ed = ix.Ix.checkoutDoc(guids[i], null, EditInfoC.mbSordDocAtt, LockC.NO);

                    // download
                    String docFile = internalMakeTempFileName(ed.document.docs[0].ext);
                    ix.Download(ed.document.docs[0].url, docFile);
                    long t2 = System.DateTime.Now.Ticks;
                    diffTicks += (t2 - t1);

                    System.IO.FileInfo fi = new System.IO.FileInfo(docFile);
                    if (fi.Length < fileSize)
                    {
                        throw new InvalidOperationException("download failed");
                    }

                    if ((i + 1) % 20 == 0)
                    {
                        Logger.instance().log("read: " + (i + 1) + "/" + nbOfDocs);
                    }

                    System.IO.File.Delete(docFile);
                }

                // Log time values
                logTimeValues("read", diffTicks, nbOfDocs);

                // 3. Delete root folder logically (implicitly deletes the 100 included Sords)
                Logger.instance().log("delete logically...");
                DateTime startTime = System.DateTime.Now;
                ix.Ix.deleteSord(null, e1.guid, LockC.NO, null);
                DateTime endTime = System.DateTime.Now;
                logTimeValues("delete logically", startTime, endTime, nbOfDocs);

                // 4. Delete root folder finally (implicitly deletes the 100 included Sords)
                Logger.instance().log("delete finally...");
                startTime = System.DateTime.Now;
                DeleteOptions delOpts = new DeleteOptions();
                delOpts.deleteFinally = true;
                ix.Ix.deleteSord(null, e1.guid, LockC.NO, delOpts);
                endTime = System.DateTime.Now;
                logTimeValues("delete finally", startTime, endTime, nbOfDocs);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
示例#7
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // 1. Create document without an associated file
                EditInfo ed = ix.Ix.createDoc("1", "0", null, EditInfoC.mbSord);
                ed.sord.name = "C# example CheckinNewDocument";
                ed.sord.id   = ix.Ix.checkinSord(ed.sord, SordC.mbAll, LockC.NO);

                // Create test file
                // 2. Checkout document
                ed = ix.Ix.checkoutDoc(ed.sord.guid, null, EditInfoC.mbSordDocAtt, LockC.YES);
                Logger.instance().log("checkout sord succeeded, objId=" + ed.document.objId);

                // Hint: Now the document is locked and will be unlocked by checkinDocEnd

                // 3. Checkin a file as a new Version
                String text     = "version 1";
                String testFile = internalCreateTestFile(text, "txt");

                // Supply the extension of the document
                ed.document.docs                  = new DocVersion[1];
                ed.document.docs[0]               = new DocVersion();
                ed.document.docs[0].ext           = ix.GetFileExt(testFile);
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;

                // CheckinDocBegin: let IndexServer generate an URL to upload the document
                ed.document = ix.Ix.checkinDocBegin(ed.document);

                // Upload the document
                String uploadResult = ix.Upload(ed.document.docs[0].url, testFile);
                ed.document.docs[0].uploadResult = uploadResult;

                // Set version comment
                ed.document.docs[0].version = "1.0";
                ed.document.docs[0].comment = "IndexServer C# example";

                // CheckinDocEnd: uploadResult contains the document information from ELODM.
                // Pass this information to
                ed.document = ix.Ix.checkinDocEnd(null, null, ed.document, LockC.YES);

                // Hint: It's not nessesary to pass a Sord object to IndexServer in checkinDocEnd,
                //       if the indexing information was not changed. IndexServer gets the
                //       object ID from ed.document.objId.

                Logger.instance().log("inserted document version:");
                Logger.instance().log("  objId=" + ed.document.objId);
                Logger.instance().log("  docId=" + ed.document.docs[0].id);
                Logger.instance().log("  doc-guid=" + ed.document.docs[0].guid);
                Logger.instance().log("  URL=" + ed.document.docs[0].url);

                // 2. Checkout and show document
                ed = ix.Ix.checkoutDoc(ed.sord.guid, ed.document.docs[0].guid, EditInfoC.mbAll, LockC.YES);
                String tempName2 = internalMakeTempFileName(ed.document.docs[0].ext);
                ix.Download(ed.document.docs[0].url, tempName2);

                // Uncomment this to show document in notepad:
                //System.Diagnostics.Process.Start("notepad.exe", tempName2);
                //System.Threading.Thread.Sleep(3000);

                System.IO.File.Delete(tempName2);

                // insert second version
                //text = "version 2";
                //testFile = internalCreateTestFile(text, "txt");
                //ed.document.docs = new DocVersion[1];
                //ed.document.docs[0] = new DocVersion();
                //ed.document.docs[0].ext = IXClient.getFileExt(testFile);
                //ed.document = ix.Ix.checkinDocBegin(ed.document);
                //uploadResult = ix.Upload(ed.document.docs[0].url, testFile);
                //ed.document.docs[0].uploadResult = uploadResult;
                //ed.document.docs[0].version = "2.0";
                //ed.document.docs[0].comment = "2.0 IndexServer C# example";
                //ed.document = ix.Ix.checkinDocEnd(null, null, ed.document, LockC.YES);

                bool cleanUp = true;
                if (cleanUp)
                {
                    // Delete Document
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, null);
                    ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // Create a document
                EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc);
                ed.sord.name     = "document with annotations";
                ed.document      = new Document();
                ed.document.docs = new DocVersion[1] {
                    new DocVersion()
                };
                ed.document.docs[0].ext           = "tif";
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF");
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);


                // Create NoteTemplate objects
                int[] noteTemplateIds = InternalCreateNoteTemplates(ix);

                // noteTemplateIds[0] ... Text "ACCEPTED"
                // noteTemplateIds[1] ... Image Stempel1.jpg



                List <Note> notes = new List <Note>();

                // Text "ACCEPTED"
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, 0, noteTemplateIds[0].ToString());

                    note.XPos   = 100;
                    note.YPos   = 200;
                    note.width  = 1000;
                    note.height = 500;

                    notes.Add(note);
                }


                // Image
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, 0, noteTemplateIds[1].ToString());

                    note.XPos   = 100;
                    note.YPos   = 800;
                    note.width  = 1000;
                    note.height = 500;

                    notes.Add(note);
                }


                int[] noteIds = ix.Ix.checkinNotes(null, notes.ToArray(), NoteC.mbAll, LockC.NO);
                Logger.instance().log("noteIds=" + noteIds);
            }
            finally
            {
                ix.Logout();
            }
        }