Esempio n. 1
0
        // Affichage d'un mail à partir de son ID
        public void displayMail(Mail mailData)
        {
            // Récupération de l'objet Application
            if (this.outlook == null)
                this.tryHook(true);

            Outlook.MailItem mail;

            if (tryGetMailFromId(mailData.EntryID, mailData.StoreID, out mail))
                mail.Display();
            else
            {
                // Le mail a été déplacé où supprimé
                TrayIcon.afficheMessage("I/F Outlook", "Le mail a été déplacé ou supprimé.");
                /*
                //TODO:Find email in Outlook by record’s MessageId
                const String PROPTAG = "http://schemas.microsoft.com/mapi/proptag/";
                const String PR_INTERNETID = "0x1035001E";
                String propName = PROPTAG + PR_INTERNETID;

                String query = propName + "='" + messageID + "'";

                String scope = "'" + outlook.ActiveExplorer().CurrentFolder.FolderPath + "'";
                // Hook de l'évènement AdvancedSearchComplete
                this.outlook.AdvancedSearchComplete += new Outlook.ApplicationEvents_11_AdvancedSearchCompleteEventHandler(outlook_AdvancedSearchComplete);
                // Perform the search, asynchronously.
                outlook.AdvancedSearch(scope, query, true, "SearchMail");
               */
            }

            if (mail != null)
                Marshal.FinalReleaseComObject(mail);
        }
Esempio n. 2
0
 public NewMailEventArgs(String titre, String storeID, String entryID, String messageID)
 {
     this.v_mail = new Mail(titre, storeID, entryID, messageID);
 }
Esempio n. 3
0
        // Insertion d'un nouveau mail en base
        public String insertMail(Mail mail)
        {
            String EncID = "";
            String titre = "'" + mail.Titre.Replace("'", "''") + "'";

            using (SQLiteConnection SQLC = new SQLiteConnection(this._connectionString))
            {
                if (File.Exists(this.path))
                    SQLC.Open();
                else
                    throw new Exception("Base inaccessible");

                using (SQLiteTransaction mytransaction = SQLC.BeginTransaction())
                {
                    using (SQLiteCommand SQLCmd = new SQLiteCommand(SQLC))
                    {
                        // Insertion du mail
                        SQLCmd.CommandText = "INSERT INTO Mails (Titre,StoreID,EntryID,MessageID) ";
                        SQLCmd.CommandText += "VALUES(" + titre + "," + mail.StoreIDSQL + "," + mail.EntryIDSQL + "," + mail.MessageIDSQL + ");";
                        SQLCmd.ExecuteNonQuery();

                        // Récupération du EncID
                        SQLCmd.CommandText = "SELECT max(id) FROM Mails;";
                        EncID = SQLCmd.ExecuteScalar().ToString();
                    }
                    mytransaction.Commit();
                }
            }
            return EncID;
        }