Share via


How to: Create a Meeting Request

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

  1. Create an instance of the Pocket Outlook application object and then use it to establish a POOM session. For more information, see How to: Establish a POOM Session.

  2. Create a PIM item. For more information, see How to: Create a PIM Item.

  3. 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);
    
  4. Set each recipient object's Address property by resolving each recipient against the Contact list. As shown in the following code, 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();
    
  5. Send the meeting request:

    pRecipients->get_Count(&iRecipientCount);
    if (iRecipientCount > 0)
        pAppt->Send();
    

Example

The following code demonstrates how to create a meeting request.

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.
    pAppt->put_Subject(TEXT("Recurring Appointment"));

    // Convert Monday, 4/5/9 at 10:00 am to a DATE.
    SYSTEMTIME st;
    DATE date;
    memset(&st, 0, sizeof(SYSTEMTIME));
    st.wMonth = 4;
    st.wDay   = 5;
    st.wYear  = 1999;
    st.wHour  = 10;
    polApp->SystemTimeToVariantTime(&st, &date);

    // Set the start date.
    pAppt->put_Start(date);

    // Add 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 contacts on the device.
    IPOlRecipient *pRecip2;
    int iRecipientCount;
    pRecipients->get_Count(&iRecipientCount);
    // Count down so that removing recipient does not reorder
    // 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();

    // Release objects.
    pRec->Release();
    pAppt->Release();
    pRecipients->Release();
    pRecipient->Release();
}

See Also

IAppointment::get_Recipients

IAppointment::Send

IRecipients::Add

IRecipient::put_Address

Pocket Outlook Object Model

Last updated on Friday, April 22, 2005

© 2005 Microsoft Corporation. All rights reserved.

Send feedback on this topic to the authors.