IRecipients::Add (Windows Embedded CE 6.0)

1/6/2010

The Add method adds a person to the list of recipients for a Meeting Request. After you add the recipient, you must set the recipient's Address property. For more information, see IRecipient::put_Address.

Syntax

HRESULT Add(
   BSTR pwszName,
   IRecipient ** pRecipient
);

Parameters

  • pwszName
    [in] Reference to a null-terminated Unicode string with the display name for the recipient. For information on the BSTR type, see BSTR.
  • pRecipient
    [out] Reference to the new IRecipient object.

Return Value

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    The method completed successfully.

Code Example

The following code example demonstrates how to create a Meeting Request, and then send it to three recipients.

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;
    VAR_BOOL             bResolved;

    // Create an Appointment item.
    polApp->CreateItem(olAppointmentItem, (IDispatch**)&pAppt);

    // Set the subject.
    pAppt->put_Subject(TEXT("Recurring Appointment"));

    // Convert the date Thursday, May 10th, 2007, at 08:30 PM, to a Variant 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 recipients.
    pAppt->get_Recipients(&pRecipients);

    // Resolve the recipients against the list of Contacts stored in the data store on the 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();

    // Release resources.
    pRec->Release();
    pAppt->Release();

    pRecipients->Release();
    pRecipient->Release();
}

Requirements

Header pimstore.h
Library Pimstore.lib
Windows Embedded CE Windows CE 2.0 and later

See Also

Tasks

Creating a Meeting Request

Reference

IRecipients
IRecipient
IPOlRecipient
Pocket Outlook Object Model Interfaces

Other Resources