Share via


IRecipients::Add

This function is not supported in Windows CE Platform Builder 3.0.

This function adds a person to the recipient list for a meeting request. After you add the recipient you must set the Address property for it.

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

Parameters

  • pwszName
    [in] This becomes the display name for the recipient.
  • pRecipient
    [out] Pointer to a pointer to the new recipient.

Return Values

S_OK indicates success. If an error occurs, the appropriate HRESULT value is returned.

Code Example

The following C++ code snippet creates a meeting and sends it to three recipients:

void CreateMeetingRequest(IPOutlookApp *polApp)
{
IRecurrencePattern *pRec;
IAppointment *pAppt;
IRecipients *pRecipients;
IRecipient *pRecipient;
VAR_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 removing recipient doesn't 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();
}

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.0 and later pimstore.h    

See Also

IRecipients::Unknown, IRecipients Property Methods

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.