void extract(out String s1, out String s2, out String s3) { String s1 = String.Empty, s2 = String.Empty, s3 = String.Empty; String Body, address, subject; Outlook._Application oApp = new Outlook.Application(); if (oApp.ActiveExplorer().Selection.Count > 0) { Object selObject = oApp.ActiveExplorer().Selection[1]; if (selObject is Outlook.MailItem) { Outlook.MailItem mailItem = (selObject as Outlook.MailItem); subject = mailItem.Subject; address = mailItem.SenderEmailAddress; Body = mailItem.Body; s1 = Body; s2 = address; s3 = subject; } } }
public int countMail() { /* * * Gives the number of selected mail. * returns: Number of selected mail. * */ cnt_mail = 0; Outlook.Application app = _outlookApplication; //app = new Microsoft.Office.Interop.Outlook.Application(); try { cnt_mail = app.ActiveExplorer().Selection.Count; } catch (Exception) { return(0); } return(cnt_mail); }
private void Form1_Shown(object sender, EventArgs e) { label1.Text = "Total number of mails in inbox: " + App.ActiveExplorer().CurrentFolder.Items.Count.ToString(); }
public void OnStartupComplete(ref System.Array custom) { //----------------------------------------------------------------------------------------------------------------------------------------------------- /* /* * * When outlook is opened it loads a Menu if Outlook plugin is installed. * OpenERP - > Push, Partner ,Documents, Configuration * #1# */ Outlook.Application app = _outlookApplication; try { object omissing = System.Reflection.Missing.Value; menuBar = app.ActiveExplorer().CommandBars.ActiveMenuBar; ConfigManager config = new ConfigManager(); config.LoadConfigurationSetting(); OpenERPOutlookPlugin openerp_outlook = Cache.OpenERPOutlookPlugin; OpenERPConnect openerp_connect = openerp_outlook.Connection; try { if (openerp_connect.URL != null && openerp_connect.DBName != null && openerp_connect.UserId != null && openerp_connect.pswrd != "") { string decodpwd = Tools.DecryptB64Pwd(openerp_connect.pswrd); openerp_connect.Login(openerp_connect.DBName, openerp_connect.UserId, decodpwd); } } catch (Exception) { //just shallow exception } newMenuBar = (Office.CommandBarPopup)menuBar.Controls.Add(MsoControlType.msoControlPopup, omissing, omissing, omissing, true); if (newMenuBar != null) { newMenuBar.Caption = "OpenERP"; newMenuBar.Tag = "My"; btn_open_partner = (Office.CommandBarButton)newMenuBar.Controls.Add(MsoControlType.msoControlButton, omissing, omissing, 1, true); btn_open_partner.Style = MsoButtonStyle.msoButtonIconAndCaption; btn_open_partner.Caption = "Contact"; //Face ID will use to show the ICON in the left side of the menu. btn_open_partner.FaceId = 3710; newMenuBar.Visible = true; btn_open_partner.ClickEvent += new Office.CommandBarButton_ClickEventHandler(this.btn_open_partner_Click); //Core._CommandBarButtonEvents_ClickEventHandler(this.btn_open_partner_Click); btn_open_document = (Office.CommandBarButton)newMenuBar.Controls.Add(MsoControlType.msoControlButton, omissing, omissing, 2, true); btn_open_document.Style = MsoButtonStyle.msoButtonIconAndCaption; btn_open_document.Caption = "Documents"; //Face ID will use to show the ICON in the left side of the menu. btn_open_document.FaceId = 258; newMenuBar.Visible = true; btn_open_document.ClickEvent += new Office.CommandBarButton_ClickEventHandler(this.btn_open_document_Click); btn_open_configuration_form = (Office.CommandBarButton)newMenuBar.Controls.Add(MsoControlType.msoControlButton, omissing, omissing, 3, true); btn_open_configuration_form.Style = MsoButtonStyle.msoButtonIconAndCaption; btn_open_configuration_form.Caption = "Configuration"; //Face ID will use to show the ICON in the left side of the menu. btn_open_configuration_form.FaceId = 5644; newMenuBar.Visible = true; btn_open_configuration_form.ClickEvent += new Office.CommandBarButton_ClickEventHandler(this.btn_open_configuration_form_Click); } } catch (Exception ex) { string message = string.Format("An error occured.{0}{0}{1}", Environment.NewLine, ex.Message); MessageBox.Show(message, "OPENERP-Initialize menu", MessageBoxButtons.OK, MessageBoxIcon.Error); } }