Share via


Creating a Meeting Request

Send Feedback

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 Outlook Mobile 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();
    

Code 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.
    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 Windows Mobile–based 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

Pocket Outlook Object Model Application Development for Windows Mobile-based DevicesIAppointment::get_Recipients | IAppointment::Send | IRecipients::Add | IRecipient::put_Address

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.