IRecipients::Add (Windows CE 5.0)
This function adds a person to the recipient list for a meeting request. After you add the recipient you must set the recipient's Address property.
HRESULT Add(BSTRpwszName,IRecipient** pRecipient);
Parameters
- pwszName
[in] Pointer to a null-terminated Unicode string with the display name for the recipient. - pRecipient
[out] Pointer to the new recipient.
Return Values
S_OK indicates success. If an error occurs, the appropriate HRESULT is returned.
Example
The following code example 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 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 ();
}
Requirements
OS Versions: Windows CE 2.0 and later.
Header: Pimstore.h.
Link Library: Pimstore.lib.
See Also
IRecipients | IRecipients Properties
Send Feedback on this topic to the authors