Where is the Outlook Body Control?

  • Thread starter Thread starter Joe Doyle
  • Start date Start date
J

Joe Doyle

Or do I recently picked up Programming Applications for Microsoft Outlook
2007 to help with an add-in I am creating using VSTO 3 & VS2008 in C#. Oneof
my goals is to use a custom form region to replace the reading pane for my
message class with a customized layout. I am able to create it just fine,
but I'm running into an issue when displaying the message body. On page 438
of the book, it references an Outlook Body Control. This control doesn't
show up as one of the Olk* controls. If I edit a form directly in Outlook, I
see the control and can use it. I also found _DDocSiteControl, but that
isn't usable in C# since there is only an interface.

Is the Outlook Body control still around or am I missing soemthing? Or is
it only avaialble for forms created in Outlook, not VS?

Thanks,
Joe
 
You can use Body directly if you want or you can use the
_DocSiteControlClass that implements the _DocSiteControl interface. That
exposes the ReadOnly and SuppressAttachments property. Look in the Object
Browser for _DocSiteControlClass.
 
I tried to use the _DocSiteControlClass but I couldn't get it to work. When
trying to set the ReadOnly property I get:
Member not found. (Exception from HRESULT: 0x80020003
(DISP_E_MEMBERNOTFOUND))

Has anyone programatically (or from the VS designer) added this control to a
form before? Google shows pretty much nothing on this. It's looking like
the only way to use this control in a custom form region is to design it in
Outlook and save it off as an .ofs file.

Joe
 
Remember that an Outlook item can only have one of those controls per form,
so if you want to use it in a form region it can't be available in the
normal part of the form.

Also, unless you really need to use the properties like ReadOnly you're
better off using the Body property or a textbox that shows Body and which
can be made read-only as part of its normal properties.

That to me is a better solution because otherwise those items won't have a
valid Notes area they can use unless the form region is running, restricting
the items to use only in Outlook 2007.

I'm not sure if anyone has been using _DocSiteControl the way you intend,
I've never seen it, so success stories may be hard to come by.
 
Hi Joe, I have a similar use case where I need to set the Message to ReadOnly. Doing so via the DocSiteControl is throwing me the same error. Any progress on your front ? Please advise here.

Part of my code here:

private Microsoft.Office.Interop.Outlook._DDocSiteControl mMessageControl;
this.mMessageControl = (Microsoft.Office.Interop.Outlook._DDocSiteControl)GetFormRegionControl("Message");
this.mMessageControl.ReadOnly = Convert.ToSByte(!value);
 
Back
Top