Accessing Outlook form controls from C# COM Add In

D

Dan Jeannotte

[Copied from previous post by David Coales in May, 2003]

Is anyone able to point me at some samples of accessing
ModifiedFormPages
controls on an outlook form from within C#. I can do it in VBA with
the
syntax "inspector.ModifiedFormPages(<formname>).Controls" but this
syntax
simply doesn't work in C#. I get the message saying ModifiedFormPages
is a
variable not a method. The methods in the Pages class include and Add
and a
Remove but no Items property.

Any help would be appreciated as almost all the examples on the net
are in
VB, VBA or VBScript.
[End copy]

There was a reply to this thread but it was incomplete. Does anyone
know how to correctly access a control on an Outlook form from within
a C# COM Add In? The code looks something like this:

using Outlook = Microsoft.Office.Interop.Outlook;

Outlook.Explorer olExp;
Outlook.Pages olPages;
Outlook.MailItem olReply;
Object obj
string strForm;
string strTest;

//olExp assigned to Outlook Application.ActiveExplorer in OnConnection
method
strForm = "IPM.Note.MyCustomForm";
olReply = (Outlook.MailItem)olExp.CurrentFolder.Items.Add(strForm);
olPages = (Outlook.Pages)olReply.GetInspector.ModifiedFormPages;
//now for the failing code...
strTest = olPages[1].Controls["MyControl"].Text;

Any ideas on syntax?

Thanks,
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top