Accessing Inspector Form Properties From External Application

Add-in Express™ Support Service
That's what is more important than anything else

Accessing Inspector Form Properties From External Application
How to Access Properties 
Bob Bartel


Guest


User added an image



I have created a form and added it to Outlook's new Appointment window (see above).

From my External C# application I have the following code:


NewAppt = outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem)
	as Outlook._AppointmentItem;


What I need to be able to do is set some properties of the AddIn fields from my external program, scheduled with, etc.

I've used the locals window to explore the properties of the NewAppt variable, but I don't see anything but the appointment. I need to see the Inspector window properties. I Display the NewAppt as follows:



if (NewAppt != null)
{NewAppt.Display(true);	}


I can see the AddIn fields displayed just fine. I assume I'm probably going about this wrong (ie., using NewApp.Display().

Can you tell me how I can access that Inspector window's properties, including my AddIn fields?

Thanks!!

bob
Posted 11 Feb, 2009 19:01:53 Top
Eugene Astafiev


Guest


Hello Bob,

1. Please have a look at the GetInspector function of the Outlook.AppointmentItem class.

2. You can find an instance of your add-in using the following code:

Application.COMAddIns.Item("ProgID of the add-in module")


To get assistance with host applications?Â?Ð?é objects, their properties, and methods as well as help info, use the Object Browser. Go to the VBA environment (in the host application, choose menu Tools / Macro / Visual Basic Editor or just press Alt+F11), press F2, select the host application (also Office and MSForms) in the topmost combo and/or specify a search string in the search combo. Select a class/property/method and press F1 to get the help topic that relates to the object.
Posted 12 Feb, 2009 04:21:15 Top
Bob Bartel


Guest


Thank you. I appreciate you telling me about how to get the instance of the addin. I had played with that command, but didn't know how to address the addin, ie., I didn't know to use the ProgID.

OK. So here is my code:



object addinref = "InspectorAddIn.AddinModule";
object Addin = outlookApp.COMAddIns.Item(ref addinref);
					
NewAppt = outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem)
	as Outlook._AppointmentItem;

if (NewAppt != null)
{inspector = NewAppt.GetInspector;
inspector.Display(true); }



The above code does give me a reference to the Addin as well as the inspector...so far so good!

My challenge is now how to address the inspector or the Addin so I can set the properties of the addin and create an Event to trap the click event of the Save button.

As you know, the object model documentation doesn't tell you anything about how to address an AddIn. Can you please give me some guidance on how to access my AddIn objects? For example, how can I set the Text property of the box labeled Scheduled With? The object name is:

txtScheduleWith

Thank you!!

bob
Posted 12 Feb, 2009 10:04:45 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Bob,

You get a reference to your add-in via
OutlookApp.COMAddins.Item("InspectorAddIn.AddinModule").Object (!). Then you use late binding to invoke any public property or method defined in your add-in module. See System.Type.InvokeMember().


Andrei Smolin
Add-in Express Team Leader
Posted 12 Feb, 2009 15:03:39 Top