ITask::GetRecurrencePattern

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The GetRecurrencePattern method gets the IRecurrencePattern object that represents the recurrence attributes of a TASK. If there are no existing recurrence attributes, an empty IRecurrencePattern object is returned.

Syntax

HRESULT GetRecurrencePattern(
   IRecurrencePattern ** ppRec
);

Parameters

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.

Example

The following code sets the recurrence pattern attributes for a new Task.

void CreateRecurringTask(IApplication * pApp)
{
    ITask              * pTask;    // A Task object.
    IRecurrencePattern * pRec;     // A recurrence pattern object.
    SYSTEMTIME           st;       // A structure representing a date and time.
    DATE                 date;     // The date/time expressed as a Variant time (as a DOUBLE).

    // Create a Task item.
    pApp->CreateItem(olTaskItem, (IDispatch**)&pTask);

    memset(&st, 0, sizeof(SYSTEMTIME));          // Set all bytes in the SYSTEMTIME structure to zero.

    // Convert the date Saturday, 05/10/07 to a Variant DATE object.
    st.wMonth = 5;
    st.wDay   = 10;
    st.wYear  = 2007;

    pApp->SystemTimetoVariantTime(&st, &date);   // date now contains the variant version of the date/time.

    // Set the start date, due date, the Importance to High, and the subject.
    pTask->put_StartDate(date);
    pTask->put_DueDate(date + 14);               // Two weeks after the start date.
    pTask->put_Importance(olImportanceHigh);
    pTask->put_Subject(TEXT("This is an example of a Recurring Task"));

    // Set the recurrence pattern.
    pTask->GetRecurrencePattern(&pRec);

    pRec->put_RecurrenceType(olRecursWeekly);
    pRec->put_DayOfWeekMask(olTuesday);
    pRec->put_NoEndDate(TRUE);

    pTask->Save();                    // Save the Task.

    pTask->Release();                 // Release resources.
    pRec->Release();
}

Requirements

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

See Also

Tasks

Creating a Recurring Appointment

Reference

ITask
Pocket Outlook Object Model Interfaces
ITask::ClearRecurrencePattern
ITask::SkipRecurrence

Other Resources

Pocket Outlook Object Model Enumerations
SYSTEMTIME