How to: Read Time Zone Properties from an Appointment

Last modified: October 26, 2010

Applies to: Office 2007 | Office 2010 | Outlook 2010

This topic shows a function, ReadTimeZones, that calls the two functions, BinToTZDEFINITION and BinToTZREG, to read the time zone properties, PidLidAppointmentTimeZoneDefinitionStartDisplay and PidLidTimeZoneStruct, from an appointment.

PidLidAppointmentTimeZoneDefinitionStartDisplay contains a stream that maps to the persisted format of a TZDEFINITION structure, and PidLidTimeZoneStruct contains a stream that maps to the persisted format of a TZREG structure. To obtain the exact TZDEFINITION and TZREG structures, BinToTZDEFINITION and BinToTZREG are used to parse the stream values of these properties appropriately. These two functions are defined in How to: Parse a Stream from a Binary Property to Read the TZDEFINITION Structure and How to: Parse a Stream from a Binary Property to Read the TZREG Structure, respectively.

void ReadTimeZones(LPMAPIPROP lpAppointment) 
    HRESULT hRes = S_OK; 
    LPSPropTagArray lpNamedPropTags = NULL; 
    MAPINAMEID NamedID[2] = {0}; 
    LPMAPINAMEID lpNamedID[2]; 
    lpNamedID[0] = &NamedID[0]; 
    lpNamedID[1] = &NamedID[1]; 
    NamedID[0].lpguid = (LPGUID)&PSETID_Appointment; 
    NamedID[0].ulKind = MNID_ID; 
    NamedID[0].Kind.lID = dispidTimeZoneStruct; 
    NamedID[1].lpguid = (LPGUID)&PSETID_Appointment; 
    NamedID[1].ulKind = MNID_ID; 
    NamedID[1].Kind.lID = dispidApptTZDefStartDisplay; 
    hRes = lpAppointment->GetIDsFromNames( 
    if (SUCCEEDED(hRes) && lpNamedPropTags) 
        SizedSPropTagArray(2,sptaTzProps) = {2, 
        LPSPropValue lpProps = NULL; 
        ULONG cProps = 0; 
        hRes = lpAppointment->GetProps( 
        if (SUCCEEDED(hRes) && 2 == cProps && lpProps) 
            if (PT_BINARY == PROP_TYPE(lpProps[0].ulPropTag)) 
                TZREG* ptzReg = BinToTZREG(lpProps[0].Value.bin.cb,lpProps[0].Value.bin.lpb); 
                // TODO: Do whatever is necessary with ptzReg. 
                delete ptzReg; 
            if (PT_BINARY == PROP_TYPE(lpProps[1].ulPropTag)) 
                TZDEFINITION* ptzDef = BinToTZDEFINITION(lpProps[1].Value.bin.cb,lpProps[1].Value.bin.lpb); 
                // TODO: Do whatever is necessary with ptzDef. 
                delete[] ptzDef; 
© 2014 Microsoft