Next Week Is MUCH Better For Me
[This is now documented here: https://msdn2.microsoft.com/en-us/library/bb905285.aspx]
This is just an interesting little nugget I was asked to document today.
Suppose you're writing some Outlook Object Model code (using Outlook 2007, of course) and are trying to classify the kinds of items you're working with. From the OOM, you'd start by looking at the type. Maybe it's Outlook.MailItem. or Outlook.Contact, etc. This article illustrates the concept.
But what about Outlook.MeetingItem? It turns out there's a number of things this could be. It could be a compose form if the message hasn't yet been sent. It could be a regular meeting response. Or it could be a counter proposal. A counter proposal is when the recipient of the request has proposed a new time for the meeting.
Detecting the compose case is easy - just check Item.Sent. But how do you tell if it's a counter proposal? That's not something we covered in the OOM. But there's a named property you can use to find out: dispidApptCounterProposal.
Since I'm a C++ guy, here's the C++ definition:
#define dispidApptCounterProposal 0x8257
The property is in the PSETID_Appointment namespace (see my blog entry on Outlook 2007 properties). It's type is PT_BOOLEAN.
Here's some C# code that shows how you might use this property from the OOM:
private bool IsCounterProposal(Outlook.MeetingItem meeting)
{
const string counterPropose =
"https://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/8257000B";
Outlook.PropertyAccessor pa = meeting.PropertyAccessor;
if ((bool)pa.GetProperty(counterPropose))
return true;
else
return false;
}
Comments
- Anonymous
January 04, 2009
Hi , I would like to ask you a queation about outlook addin. I want to make a new MeetingItem programmatically with C++ (without using VSTO). I could make new appointment item but not a new meeting item. This was my code : ============================ void CMFCDlg::OnButton1() { _Application olApp; COleException e; if(!olApp.CreateDispatch("Outlook.Application", &e)) { CString str; str.Format("CreateDispatch() failed w/error 0x%08lx", e.m_sc); AfxMessageBox(str, MB_SETFOREGROUND); return; } _NameSpace olNs(olApp.GetNamespace("MAPI")); COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); olNs.Logon(covOptional, covOptional, covOptional, covOptional); // Create a new appointment _MeetingItem olAppt(olApp.CreateItem(1)); VARIANT Modal; bool bTest=true; VariantInit(&Modal); // Save Appointment olAppt.Save(); olAppt.Display(Modal); } ======================== Can you help me please? -Aneesh