public static void MultiQuickIndex(Outlook.MailItem email, string folder)
        {
            try
            {
                XLant.XLVirtualCabinet.BondResult outcome = IndexEmail(email, folder);
                // As the filing has been successfull, get the FileId returned from Bond via the Standard Output
                if (outcome.ExitCode == 0)
                {
                    string fileid = Regex.Match(outcome.StandardOutput, @"\d+").ToString();
                    XLVirtualCabinet.FileInfo info = XLVirtualCabinet.FileIndex(fileid);
                    DialogResult result            = MessageBox.Show("Do you want to index another copy", "Index", MessageBoxButtons.YesNo);
                    while (result == DialogResult.Yes)
                    {
                        XLForms.ClientForm myForm = new ClientForm();
                        myForm.ShowDialog();
                        XLMain.Client client = myForm.selectedClient;
                        //update the cabinet based on the new client
                        string cabinet = XLVirtualCabinet.FileStore(client.manager.office, client.department);
                        info.Cabinet = cabinet;
                        //update the client field
                        foreach (XLVirtualCabinet.IndexPair pair in info.Indexes)
                        {
                            if (pair.index == "INDEX02")
                            {
                                pair.value = client.clientcode + " - " + client.name;
                            }
                        }
                        outcome = XLVirtualCabinet.IndexDocument(outcome.DocPath, info);

                        if (outcome.ExitCode == 0)
                        {
                            result = MessageBox.Show("Do you want to index another copy", "Index", MessageBoxButtons.YesNo);
                            continue;
                        }
                        else
                        {
                            MessageBox.Show("Unable to index document, please index manually.  Error code: " + outcome.ExitCode.ToString() + "-" + outcome.StandardOutput.ToString());
                            break;
                        }
                    }
                    //update the tick box and category
                    UpdateVCTick(email);
                    //delete email from temp directory
                    if (File.Exists(outcome.DocPath))
                    {
                        File.Delete(outcome.DocPath);
                    }
                }
                else
                {
                    Exception e = new Exception("Unable to index");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to index email");
                XLtools.LogException("MultiQuickIndex", ex.ToString());
            }
        }
        private void IndexBtn_Click(object sender, EventArgs e)
        {
            string folder   = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\XLant\\temp\\";
            string tempPath = folder + "temp.msg";

            email.SaveAs(tempPath);

            string cabinet   = XLVirtualCabinet.FileStore(client.office, client.department);
            string clientStr = client.clientcode + " - " + client.name;
            string status    = "";

            if (email.ReceivedTime != null)
            {
                status = "External";
            }
            else if (email.SentOn != null)
            {
                status = "Sent";
            }
            else
            {
                status = "Draft";
            }
            XLMain.Staff toBe    = (XLMain.Staff)ToBeActionDDL.SelectedItem;
            string       desc    = DescTB.Text;
            string       section = "";

            if (client.department != "INS")
            {
                section = "Correspondence";
            }
            else
            {
                section = FileSectionDDL.SelectedItem.ToString();
            }
            //Launch the index process and collect the result
            XLVirtualCabinet.BondResult outcome = XLVirtualCabinet.IndexDocument(tempPath, cabinet, clientStr, status, toBe.name, section, desc);

            //close the dialog in any event.
            this.Close();
        }
        private void IndexBtn_Click(object sender, EventArgs e)
        {
            string fullPath       = docPath;
            string cabinet        = XLVirtualCabinet.FileStore(client.manager.office, client.department);
            string clientStr      = client.clientcode + " - " + client.name;
            string toBeActionedBy = null;

            if (ToBeActionDDL.SelectedValue == null)
            {
                toBeActionedBy = "";
            }
            else
            {
                XLMain.EntityCouplet toBe = (XLMain.EntityCouplet)ToBeActionDDL.SelectedItem;
                toBeActionedBy = toBe.name;
            }
            //collect information from the two optional ddls use whether they are visible or not to acsertain whether
            //to include them - They may not be visible but still hold data.
            XLVirtualCabinet.IndexPair list1Data = new XLVirtualCabinet.IndexPair();
            XLVirtualCabinet.IndexPair list2Data = new XLVirtualCabinet.IndexPair();
            if (ListDDL1.Visible)
            {
                list1Data.index = list1.index;
                list1Data.value = ListDDL1.Text;
            }
            if (ListDDL2.Visible)
            {
                list2Data.index = list2.index;
                list2Data.value = ListDDL2.Text;
            }

            string desc    = DescTB.Text;
            string section = "";

            section = FileSectionDDL.SelectedItem.ToString();
            //Launch the index process and collect the result
            outcome = XLVirtualCabinet.IndexDocument(fullPath, cabinet, clientStr, status, toBeActionedBy, section, desc, docDate, list1Data, list2Data);

            this.Close();
        }