private void DoSimpleMAPI() { IntPtr session = IntPtr.Zero; string messageID = String.Empty; MapiMessage message = new MapiMessage(); MapiRecipDesc recipient = new MapiRecipDesc(); AddinExpress.Outlook.SecurityManager securityManager2 = new AddinExpress.Outlook.SecurityManager(); tbInfo.Clear(); if (MAPILogon(0, "", "", MAPI_LOGON_UI, 0, out session) == 0) { if (rbOFF.Checked) { securityManager2.DisableSMAPIWarnings = true; } try { IntPtr mID = Marshal.AllocHGlobal(2048); if (mID != IntPtr.Zero) { try { MAPIFindNext(session, 0, "", "", MAPI_LONG_MSGID, 0, mID); IntPtr lpMessage = IntPtr.Zero; MAPIReadMail(session, 0, mID, MAPI_ENVELOPE_ONLY | MAPI_PEEK | MAPI_SUPPRESS_ATTACH, 0, ref lpMessage); if (lpMessage != IntPtr.Zero) { message = (MapiMessage)Marshal.PtrToStructure(lpMessage, typeof(MapiMessage)); recipient = (MapiRecipDesc)Marshal.PtrToStructure(message.lpOriginator, typeof(MapiRecipDesc)); string[] lines = new string[4]; lines[0] = ("*** First message in Microsoft Outlook inbox (Outlook Object Model) ***"); lines[1] = ""; lines[2] = "From: " + recipient.lpszName; lines[3] = "Subject: " + message.lpszSubject; tbInfo.Lines = lines; MAPIFreeBuffer(lpMessage); } } catch { } finally { Marshal.FreeHGlobal(mID); } } } finally { if (rbOFF.Checked) { securityManager2.DisableSMAPIWarnings = false; } MAPILogoff(session, 0, 0, 0); } } }
public OutlookContactManager() { if (this.IsInstalled) { olSecurityManager = new AddinExpress.Outlook.SecurityManager(); try { _outlookApplication = new Microsoft.Office.Interop.Outlook.ApplicationClass(); } catch { errorCreatingOutlookApp = true; return; } try { olSecurityManager.ConnectTo(_outlookApplication); } catch { } } }
public OutlookContactManager() { if (this.IsInstalled) { olSecurityManager = new AddinExpress.Outlook.SecurityManager(); try { _outlookApplication = new Microsoft.Office.Interop.Outlook.ApplicationClass(); } catch { errorCreatingOutlookApp = true; return; } try { olSecurityManager.ConnectTo(_outlookApplication); } catch { } } }
/// <summary> /// Required by designer support - do not modify /// the following method /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddinModule)); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.cmbSecurityManager = new AddinExpress.MSO.ADXOlExplorerCommandBar(this.components); this.btnMode = new AddinExpress.MSO.ADXCommandBarButton(this.components); this.btnContacts = new AddinExpress.MSO.ADXCommandBarButton(this.components); this.btnMessage = new AddinExpress.MSO.ADXCommandBarButton(this.components); this.adxOutlookEvents = new AddinExpress.MSO.ADXOutlookAppEvents(this.components); this.securityManager1 = new AddinExpress.Outlook.SecurityManager(); this.RibbonTabSecurityManager = new AddinExpress.MSO.ADXRibbonTab(this.components); this.RibbonGroupSecurityManager = new AddinExpress.MSO.ADXRibbonGroup(this.components); this.RibbonButtonMode = new AddinExpress.MSO.ADXRibbonButton(this.components); this.RibbonButtonContacts = new AddinExpress.MSO.ADXRibbonButton(this.components); this.RibbonButtonMessage = new AddinExpress.MSO.ADXRibbonButton(this.components); this.adxRibbonButtonGroup1 = new AddinExpress.MSO.ADXRibbonButtonGroup(this.components); // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, ""); this.imageList1.Images.SetKeyName(1, ""); this.imageList1.Images.SetKeyName(2, ""); this.imageList1.Images.SetKeyName(3, ""); // // cmbSecurityManager // this.cmbSecurityManager.CommandBarName = "Security Manager .NET"; this.cmbSecurityManager.CommandBarTag = "19CD1F5B-F746-4146-A614-459AAD87FB38"; this.cmbSecurityManager.Controls.Add(this.btnMode); this.cmbSecurityManager.Controls.Add(this.btnContacts); this.cmbSecurityManager.Controls.Add(this.btnMessage); this.cmbSecurityManager.Temporary = true; this.cmbSecurityManager.UpdateCounter = 13; // // btnMode // this.btnMode.Caption = "Security (ON)"; this.btnMode.ControlTag = "947ca615-7c35-4a08-a0e6-3814e12a7b94"; this.btnMode.Image = 0; this.btnMode.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.btnMode.Style = AddinExpress.MSO.ADXMsoButtonStyle.adxMsoButtonIconAndCaption; this.btnMode.Tag = "10"; this.btnMode.Temporary = true; this.btnMode.TooltipText = "Switch security"; this.btnMode.UpdateCounter = 22; this.btnMode.Click += new AddinExpress.MSO.ADXClick_EventHandler(this.CommonButtonClick); // // btnContacts // this.btnContacts.BeginGroup = true; this.btnContacts.Caption = "Enum Contacts"; this.btnContacts.ControlTag = "82cd1e32-41e8-4358-a8fe-7ed9bc5ddbc3"; this.btnContacts.Image = 2; this.btnContacts.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.btnContacts.Style = AddinExpress.MSO.ADXMsoButtonStyle.adxMsoButtonIcon; this.btnContacts.Tag = "20"; this.btnContacts.Temporary = true; this.btnContacts.TooltipText = "Show Contacts"; this.btnContacts.UpdateCounter = 23; this.btnContacts.Click += new AddinExpress.MSO.ADXClick_EventHandler(this.CommonButtonClick); // // btnMessage // this.btnMessage.Caption = "Get Message Details"; this.btnMessage.ControlTag = "a13aa433-87a9-4a12-9dcd-de1c52f3df75"; this.btnMessage.Image = 3; this.btnMessage.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.btnMessage.Style = AddinExpress.MSO.ADXMsoButtonStyle.adxMsoButtonIcon; this.btnMessage.Tag = "30"; this.btnMessage.Temporary = true; this.btnMessage.TooltipText = "Message details"; this.btnMessage.UpdateCounter = 20; this.btnMessage.Click += new AddinExpress.MSO.ADXClick_EventHandler(this.CommonButtonClick); // // adxOutlookEvents // this.adxOutlookEvents.ExplorerSelectionChange += new AddinExpress.MSO.ADXOlExplorer_EventHandler(this.adxOutlookEvents_ExplorerSelectionChange); this.adxOutlookEvents.ExplorerFolderSwitch += new AddinExpress.MSO.ADXOlExplorer_EventHandler(this.adxOutlookEvents_ExplorerFolderSwitch); // // RibbonTabSecurityManager // this.RibbonTabSecurityManager.Caption = "Security Manager .NET"; this.RibbonTabSecurityManager.Controls.Add(this.RibbonGroupSecurityManager); this.RibbonTabSecurityManager.Id = "adxRibbonTab_b467dcde14a448aca4fcf7223c261918"; this.RibbonTabSecurityManager.Ribbons = AddinExpress.MSO.ADXRibbons.msrOutlookExplorer; // // RibbonGroupSecurityManager // this.RibbonGroupSecurityManager.Caption = "Security Manager .NET"; this.RibbonGroupSecurityManager.Controls.Add(this.RibbonButtonMode); this.RibbonGroupSecurityManager.Controls.Add(this.adxRibbonButtonGroup1); this.RibbonGroupSecurityManager.Id = "adxRibbonGroup_b4b3e8c77aa84009aedd8b8c28cd1675"; this.RibbonGroupSecurityManager.ImageTransparentColor = System.Drawing.Color.Transparent; this.RibbonGroupSecurityManager.Ribbons = AddinExpress.MSO.ADXRibbons.msrOutlookExplorer; // // RibbonButtonMode // this.RibbonButtonMode.Caption = "Security (ON)"; this.RibbonButtonMode.Id = "adxRibbonButton_f63fa01bdd234417a3c712edceaff55e"; this.RibbonButtonMode.Image = 0; this.RibbonButtonMode.ImageList = this.imageList1; this.RibbonButtonMode.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.RibbonButtonMode.Ribbons = AddinExpress.MSO.ADXRibbons.msrOutlookExplorer; this.RibbonButtonMode.ToggleButton = true; this.RibbonButtonMode.OnClick += new AddinExpress.MSO.ADXRibbonOnAction_EventHandler(this.RibbonButtonMode_OnClick); // // RibbonButtonContacts // this.RibbonButtonContacts.Caption = "Show Contacts"; this.RibbonButtonContacts.Id = "adxRibbonButton_3c514a06998b4ca89c5bbec1a2ea1da7"; this.RibbonButtonContacts.Image = 2; this.RibbonButtonContacts.ImageList = this.imageList1; this.RibbonButtonContacts.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.RibbonButtonContacts.Ribbons = AddinExpress.MSO.ADXRibbons.msrOutlookExplorer; this.RibbonButtonContacts.ScreenTip = "Show Contacts"; this.RibbonButtonContacts.OnClick += new AddinExpress.MSO.ADXRibbonOnAction_EventHandler(this.RibbonButtonContacts_OnClick); // // RibbonButtonMessage // this.RibbonButtonMessage.Caption = "Message details"; this.RibbonButtonMessage.Id = "adxRibbonButton_da6bc0612f0f41ddbf3e8fbc9b041e9c"; this.RibbonButtonMessage.Image = 3; this.RibbonButtonMessage.ImageList = this.imageList1; this.RibbonButtonMessage.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.RibbonButtonMessage.Ribbons = AddinExpress.MSO.ADXRibbons.msrOutlookExplorer; this.RibbonButtonMessage.ScreenTip = "Message details"; this.RibbonButtonMessage.OnClick += new AddinExpress.MSO.ADXRibbonOnAction_EventHandler(this.RibbonButtonMessage_OnClick); // // adxRibbonButtonGroup1 // this.adxRibbonButtonGroup1.Controls.Add(this.RibbonButtonContacts); this.adxRibbonButtonGroup1.Controls.Add(this.RibbonButtonMessage); this.adxRibbonButtonGroup1.Id = "adxRibbonButtonGroup_778acc6d2f4d4b41ba12bc3152d48502"; this.adxRibbonButtonGroup1.Ribbons = AddinExpress.MSO.ADXRibbons.msrOutlookExplorer; // // AddinModule // this.AddinName = "Security Manager Sample (2005)"; this.Images = this.imageList1; this.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook; this.AddinInitialize += new AddinExpress.MSO.ADXEvents_EventHandler(this.AddinModule_AddinInitialize); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.rbMAPI = new System.Windows.Forms.RadioButton(); this.rbCDO = new System.Windows.Forms.RadioButton(); this.rbOOM = new System.Windows.Forms.RadioButton(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.rbOFF = new System.Windows.Forms.RadioButton(); this.rbON = new System.Windows.Forms.RadioButton(); this.lbInfo = new System.Windows.Forms.Label(); this.btnGetInfo = new System.Windows.Forms.Button(); this.tbInfo = new System.Windows.Forms.RichTextBox(); this.securityManager1 = new AddinExpress.Outlook.SecurityManager(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.rbMAPI); this.groupBox1.Controls.Add(this.rbCDO); this.groupBox1.Controls.Add(this.rbOOM); this.groupBox1.Location = new System.Drawing.Point(16, 16); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(176, 112); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Access Type"; // // rbMAPI // this.rbMAPI.Location = new System.Drawing.Point(16, 72); this.rbMAPI.Name = "rbMAPI"; this.rbMAPI.Size = new System.Drawing.Size(104, 24); this.rbMAPI.TabIndex = 2; this.rbMAPI.Text = "Simple MAPI"; // // rbCDO // this.rbCDO.Location = new System.Drawing.Point(16, 48); this.rbCDO.Name = "rbCDO"; this.rbCDO.Size = new System.Drawing.Size(104, 24); this.rbCDO.TabIndex = 1; this.rbCDO.Text = "CDO"; // // rbOOM // this.rbOOM.Checked = true; this.rbOOM.Location = new System.Drawing.Point(16, 24); this.rbOOM.Name = "rbOOM"; this.rbOOM.Size = new System.Drawing.Size(104, 24); this.rbOOM.TabIndex = 0; this.rbOOM.TabStop = true; this.rbOOM.Text = "OOM"; // // groupBox2 // this.groupBox2.Controls.Add(this.rbOFF); this.groupBox2.Controls.Add(this.rbON); this.groupBox2.Location = new System.Drawing.Point(208, 16); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(152, 88); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "Security"; // // rbOFF // this.rbOFF.Location = new System.Drawing.Point(24, 48); this.rbOFF.Name = "rbOFF"; this.rbOFF.Size = new System.Drawing.Size(104, 24); this.rbOFF.TabIndex = 1; this.rbOFF.Text = "OFF"; // // rbON // this.rbON.Checked = true; this.rbON.Location = new System.Drawing.Point(24, 24); this.rbON.Name = "rbON"; this.rbON.Size = new System.Drawing.Size(104, 24); this.rbON.TabIndex = 0; this.rbON.TabStop = true; this.rbON.Text = "ON"; // // lbInfo // this.lbInfo.Location = new System.Drawing.Point(3, 147); this.lbInfo.Name = "lbInfo"; this.lbInfo.Size = new System.Drawing.Size(352, 24); this.lbInfo.TabIndex = 2; this.lbInfo.Text = "Information:"; this.lbInfo.TextAlign = System.Drawing.ContentAlignment.BottomLeft; // // btnGetInfo // this.btnGetInfo.Location = new System.Drawing.Point(280, 112); this.btnGetInfo.Name = "btnGetInfo"; this.btnGetInfo.Size = new System.Drawing.Size(75, 23); this.btnGetInfo.TabIndex = 3; this.btnGetInfo.Text = "Get Info"; this.btnGetInfo.Click += new System.EventHandler(this.btnGetInfo_Click); // // tbInfo // this.tbInfo.BackColor = System.Drawing.SystemColors.Window; this.tbInfo.Dock = System.Windows.Forms.DockStyle.Bottom; this.tbInfo.Location = new System.Drawing.Point(0, 176); this.tbInfo.Name = "tbInfo"; this.tbInfo.ReadOnly = true; this.tbInfo.Size = new System.Drawing.Size(370, 232); this.tbInfo.TabIndex = 4; this.tbInfo.Text = ""; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(370, 408); this.Controls.Add(this.tbInfo); this.Controls.Add(this.btnGetInfo); this.Controls.Add(this.lbInfo); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Name = "Form1"; this.Text = "Simple App"; this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.panel1 = new System.Windows.Forms.Panel(); this.splitter2 = new System.Windows.Forms.Splitter(); this.toolBar1 = new System.Windows.Forms.ToolBar(); this.tbtnSend = new System.Windows.Forms.ToolBarButton(); this.tbtnMode = new System.Windows.Forms.ToolBarButton(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.txbSubject = new System.Windows.Forms.TextBox(); this.txbBCC = new System.Windows.Forms.TextBox(); this.txbCC = new System.Windows.Forms.TextBox(); this.txbTO = new System.Windows.Forms.TextBox(); this.txbMail = new System.Windows.Forms.RichTextBox(); this.splitter1 = new System.Windows.Forms.Splitter(); this.securityManager1 = new AddinExpress.Outlook.SecurityManager(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.Controls.Add(this.splitter2); this.panel1.Controls.Add(this.toolBar1); this.panel1.Controls.Add(this.label4); this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.label1); this.panel1.Controls.Add(this.txbSubject); this.panel1.Controls.Add(this.txbBCC); this.panel1.Controls.Add(this.txbCC); this.panel1.Controls.Add(this.txbTO); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(538, 168); this.panel1.TabIndex = 0; // // splitter2 // this.splitter2.BackColor = System.Drawing.SystemColors.ControlDark; this.splitter2.Dock = System.Windows.Forms.DockStyle.Top; this.splitter2.Enabled = false; this.splitter2.Location = new System.Drawing.Point(0, 42); this.splitter2.Name = "splitter2"; this.splitter2.Size = new System.Drawing.Size(538, 1); this.splitter2.TabIndex = 13; this.splitter2.TabStop = false; // // toolBar1 // this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.tbtnSend, this.tbtnMode }); this.toolBar1.DropDownArrows = true; this.toolBar1.ImageList = this.imageList1; this.toolBar1.Location = new System.Drawing.Point(0, 0); this.toolBar1.Name = "toolBar1"; this.toolBar1.ShowToolTips = true; this.toolBar1.Size = new System.Drawing.Size(538, 42); this.toolBar1.TabIndex = 12; this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick); // // tbtnSend // this.tbtnSend.ImageIndex = 0; this.tbtnSend.Name = "tbtnSend"; this.tbtnSend.Text = "Send"; this.tbtnSend.ToolTipText = "Send mail"; // // tbtnMode // this.tbtnMode.ImageIndex = 1; this.tbtnMode.Name = "tbtnMode"; this.tbtnMode.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton; this.tbtnMode.Text = "Security"; this.tbtnMode.ToolTipText = "Security mode"; // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Fuchsia; this.imageList1.Images.SetKeyName(0, ""); this.imageList1.Images.SetKeyName(1, ""); this.imageList1.Images.SetKeyName(2, ""); // // label4 // this.label4.Location = new System.Drawing.Point(16, 128); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(48, 23); this.label4.TabIndex = 10; this.label4.Text = "Subject:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label3 // this.label3.Location = new System.Drawing.Point(16, 104); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(48, 23); this.label3.TabIndex = 9; this.label3.Text = "Bcc:"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.Location = new System.Drawing.Point(16, 80); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(48, 23); this.label2.TabIndex = 8; this.label2.Text = "Cc:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label1 // this.label1.Location = new System.Drawing.Point(16, 56); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(48, 23); this.label1.TabIndex = 7; this.label1.Text = "To:"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // txbSubject // this.txbSubject.Location = new System.Drawing.Point(72, 128); this.txbSubject.Name = "txbSubject"; this.txbSubject.Size = new System.Drawing.Size(448, 20); this.txbSubject.TabIndex = 6; // // txbBCC // this.txbBCC.Location = new System.Drawing.Point(72, 104); this.txbBCC.Name = "txbBCC"; this.txbBCC.Size = new System.Drawing.Size(448, 20); this.txbBCC.TabIndex = 5; // // txbCC // this.txbCC.Location = new System.Drawing.Point(72, 80); this.txbCC.Name = "txbCC"; this.txbCC.Size = new System.Drawing.Size(448, 20); this.txbCC.TabIndex = 4; // // txbTO // this.txbTO.Location = new System.Drawing.Point(72, 56); this.txbTO.Name = "txbTO"; this.txbTO.Size = new System.Drawing.Size(448, 20); this.txbTO.TabIndex = 3; // // txbMail // this.txbMail.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txbMail.Dock = System.Windows.Forms.DockStyle.Bottom; this.txbMail.Location = new System.Drawing.Point(0, 168); this.txbMail.Name = "txbMail"; this.txbMail.Size = new System.Drawing.Size(538, 216); this.txbMail.TabIndex = 1; this.txbMail.Text = ""; // // splitter1 // this.splitter1.BackColor = System.Drawing.SystemColors.ControlDark; this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom; this.splitter1.Enabled = false; this.splitter1.Location = new System.Drawing.Point(0, 167); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(538, 1); this.splitter1.TabIndex = 2; this.splitter1.TabStop = false; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(538, 384); this.Controls.Add(this.splitter1); this.Controls.Add(this.panel1); this.Controls.Add(this.txbMail); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Name = "Form1"; this.Text = "Send Mail"; this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.ResumeLayout(false); }