This might seem like a bit of a dumb question, I added the reference "MS
Forms 2.0" to the project but the Visual Studio dos'nt seem to recognize
OLForms as a valid namespace, am I missing some else ?
"Ken Slovak - [MVP - Outlook]" wrote:
Something along the lines of this should work.
First, set a reference to the COM library MS Forms 2.0 (the controls, pages,
etc. for Outlook forms).
Then, in your VSTO code (I'm showing this as part of the startup procedure,
it can be anywhere you need to work with the controls). I just used
ActiveInspector, assuming it was the custom form needed. But the code should
work as an example, and made up control names.
public partial class ThisApplication
{
private Outlook.Application m_Application;
private Outlook.Inspector oInsp;
private OLForms.Pages colPages;
private OLForms.Page oPage;
private OLForms.Controls colControls;
private void ThisApplication_Startup(object sender, System.EventArgs
e)
{
OLForms.TextBox oTBox;
OLForms.ComboBox oCombo;
m_Application = application as Outlook.Application;
oInsp=m_Application.ActiveInspector;
colPages = oInsp.ModifiedFormPages;
oPage = colPages.Item("MyPage");
colControls = oPage.Controls;
oTBox = colControls.Item("MyTextBox");
oCombo = colControls.Item("MyCombo);
From there the oTBox and oCombo objects expose all the properties exposed by
text box and combo box controls.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"lg" wrote in message
...
Hi Ken,
I think it might work if I customize the form using the forms
designer but I will still need to be able to access the controls on the
new
tab. For example, I create a new tab (on the appointmentItem) called
"Extra
Details" and add a combo box and a text box. How do I access these control
using C# with VSTO ? Thanks of the help 