Example #1
0
        public MailTable IndexSinglePst()
        {
            Microsoft.Office.Interop.Outlook.Application otlApplication = new Microsoft.Office.Interop.Outlook.Application();
            try
            {
                Outlook.NameSpace otlNameSpace = otlApplication.GetNamespace("MAPI");

                Outlook.Store      otlStore = otlNameSpace.PickFolder().Store;
                System.IO.FileInfo fi       = new System.IO.FileInfo(otlStore.FilePath);
                this.mailTable = new MailTable((new System.IO.FileInfo(otlStore.FilePath)).Name);
                this.mailTable.ModifiedData = fi.FullName + fi.Length.ToString();
                //this.mailTable.BaseTable = GMS.MailTable.getTable(this.mailTable.BaseTable, basetable.Select("StoreID<>'"+otlStore.StoreID.ToString()+"'"));
                try
                {
                    analyseFolder((Outlook.Folder)otlStore.GetRootFolder());
                }
                catch
                {
                }
            }



            catch
            {
            }
            finally
            {
                otlApplication = null;
            }

            return(this.mailTable);
        }
Example #2
0
        public void SerializeObject(string filepath, MailTable mailTable)
        {
            Stream          stream     = File.Open(filepath + "\\" + mailTable.FileName, FileMode.Create, FileAccess.Write);
            BinaryFormatter bFormatter = new BinaryFormatter();

            bFormatter.Serialize(stream, mailTable);
            stream.Close();
        }
Example #3
0
        public bool BuildCatalogue(string outfolder)
        {
            bool unchanged = true;

            Microsoft.Office.Interop.Outlook.Application otlApplication = new Microsoft.Office.Interop.Outlook.Application();
            try
            {
                Outlook.NameSpace otlNameSpace = otlApplication.GetNamespace("MAPI");

                foreach (Outlook.Store otlStore in otlNameSpace.Stores)
                {
                    if (otlStore.DisplayName == "Public Folders")
                    {
                        continue;
                    }
                    string             pststamp = StampPST((Outlook.Folder)otlStore.GetRootFolder());
                    System.IO.FileInfo fi       = new System.IO.FileInfo(otlStore.FilePath);
                    this.mailTable = new MailTable(fi.Name);
                    System.IO.FileInfo mtfi = new System.IO.FileInfo(outfolder + "\\" + this.mailTable.FileName);
                    if (mtfi.Exists)
                    {
                        try
                        {
                            MailTable mt = new Serializer().DeSerializeObject(mtfi.FullName);
                            if (pststamp == mt.ModifiedData)
                            {
                                continue;
                            }
                        }
                        catch
                        {
                        }
                    }
                    unchanged = false;
                    try
                    {
                        analyseFolder((Outlook.Folder)otlStore.GetRootFolder());
                    }
                    catch
                    {
                    }


                    this.mailTable.ModifiedData = pststamp;
                    new Serializer().SerializeObject(outfolder, this.mailTable);
                }
            }
            catch
            {
            }
            finally
            {
                otlApplication = null;
            }
            return(unchanged);
        }
Example #4
0
        public MailTable ReadCatalogue(string CataloguePath)
        {
            foreach (string filepath in System.IO.Directory.GetFiles(CataloguePath, "*.ose"))
            {
                MailTable mt = (new Serializer().DeSerializeObject(filepath));
                //System.IO.FileInfo fi=new System.IO.FileInfo(filepath);
                //mt.FileName = fi.Name;
                foreach (System.Data.DataRow dr in mt.BaseTable.Select())
                {
                    //string s = DateTime.Parse( dr["mailtime"].ToString()).ToString("HH:mm:ss");
                    //dr["mailtime"] = s;
                    mailTable.BaseTable.ImportRow(dr);
                }


                //new Serializer().SerializeObject("C:\\Mails\\OSE_Test\\", mt);
            }
            return(mailTable);
        }