Creating a Meeting Request
A version of this page is also available for
4/8/2010
Any Appointment becomes a Meeting Request when you retrieve its recipients list, specify one or more recipients, and then send the appointment information to the recipients.
To create a meeting request
Create an instance of the Outlook Mobile application object and then use it to establish a POOM session. For more information, see Establishing a POOM Session.
Create a PIM item. For more information, see Creating a PIM Item.
Retrieve and populate the Appointment's Recipient List, as follows:
pAppt->get_Recipients(&pRecipients); pRecipients->Add(TEXT("Kathryn Wilson"), &pRecipient); pRecipients->Add(TEXT("Blanca"), &pRecipient); pRecipients->Add(TEXT("Robert"), &pRecipient);
Set each Recipient object's Address property by resolving each recipient against the Contacts List. Iterate backward through the Recipients List so that the remaining unresolved Recipients are not reordered when a Recipient is removed from the list:
IPOlRecipient * pRecip2; int iRecipientCount; pRecipients->get_Count(&iRecipientCount); for (int i = iRecipientCount; i > 0; i--) { pRecipients->Item(i, &pRecipient) pRecipient->QueryInterface(IID_IPOlRecipient, (LPVOID*)&pRecip2); pRecip2->Resolve(TRUE, &bResolved); if (!bResolved) { pRecipients->Remove(i); } pRecip2->Release(); }
Send the Meeting Request:
pRecipients->get_Count(&iRecipientCount); if (iRecipientCount > 0) { pAppt->Send(); }
Example
The following code example demonstrates how to create a meeting request.
Note
To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
void CreateMeetingRequest(IPOutlookApp * polApp)
{
IRecurrencePattern * pRec;
IAppointment * pAppt;
IRecipients * pRecipients;
IRecipient * pRecipient;
BOOL bResolved
// Add a new Appointment.
polApp->CreateItem(olAppointmentItem, (IDispatch**)&pAppt);
// Set the Subject on the Appointment item.
pAppt->put_Subject(TEXT("Recurring Appointment"));
// Convert the date Thursday, 05/10/07 at 8:30 PM, to a DATE object.
SYSTEMTIME st;
DATE date;
memset(&st, 0, sizeof(SYSTEMTIME));
st.wMonth = 5;
st.wDay = 10;
st.wYear = 2007;
st.wHour = 20.5;
polApp->SystemTimeToVariantTime(&st, &date);
// Set the Start date.
pAppt->put_Start(date);
// Add the recipients.
pAppt->get_Recipients(&pRecipients);
pRecipients->Add(TEXT("Kathryn Wilson"), &pRecipient);
pRecipients->Add(TEXT("Blanca"), &pRecipient);
pRecipients->Add(TEXT("Robert"), &pRecipient);
// Resolve the recipients against the list of Contacts on the mobile device.
IPOlRecipient * pRecip2;
int iRecipientCount;
pRecipients->get_Count(&iRecipientCount);
// Count downward so that removing recipient does not reorder the remaining unresolved recipients.
for (int i = iRecipientCount; i > 0; i--)
{
pRecipients->Item(i, &pRecipient)
pRecipient->QueryInterface(IID_IPOlRecipient, (LPVOID*)&pRecip2);
pRecip2->Resolve(TRUE, &bResolved);
if (!bResolved)
{
pRecipients->Remove(i);
}
pRecip2->Release();
}
// Send the Meeting Request.
pRecipients->get_Count(&iRecipientCount);
if (iRecipientCount > 0)
{
pAppt->Send();
{
}
To make the code example easier to read, security checking and error handling are not included.
This code example should not be used in a release configuration unless it has been modified to include them.
Compiling the Code
- Include Header File: PimStore.h
- Linker Dependency: PimStore.lib
See Also
Reference
IAppointment::get_Recipients
IAppointment::Send
IRecipients::Add
IRecipient::put_Address
Other Resources
Pocket Outlook Object Model Common Tasks
Pocket Outlook Object Model Application Development