Partager via


CHANGE_PROP_TYPE (Compact 7)

3/12/2014

The CHANGE_PROP_TYPE macro returns the property tag with an updated property type; the input parameter of the property identifier is unchanged.

Syntax

CHANGE_PROP_TYPE (ulPropTag, ulPropType)

Parameters

  • ulPropTag
    The property tag to be modified.
  • ulPropType
    The new value for the property type.

Code Example

The following code example demonstrates how using CHANGE_PROP_TYPE allows you to send UNICODE characters in SMS messages.

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.

HRESULT SMS_SetMsgProps(LPMESSAGE pmsg, LPWSTR pText, IMsgStore* pMsgStore)
{
    HRESULT hr;
    LPSPropTagArray ptagArray = NULL;
    MAPINAMEID rgMapiNames[] = { { const_cast<GUID *> (&PS_MAPI), MNID_STRING, const_cast<LPWSTR>(L"SMS:Unicode") } };
    SPropValue props[2];

    // determine the property tag ID for configuring whether an SMS message is UNICODE
    hr = pMsgStore->GetIDsFromNames(sizeof(rgMapiNames) / sizeof(rgMapiNames[0]), &rgMapiNames, MAPI_CREATE, &ptagArray);
    // error handling here if hr < 0
 
    ZeroMemory(&props, sizeof(props));        
    // Set Message content using PR_SUBJECT_W for Unicode Support
    props[0].ulPropTag = PR_SUBJECT_W;
    props[0].Value.lpszW = pText;
    props[1].ulPropTag = CHANGE_PROP_TYPE (ptagArray->aulPropTag[0], PT_BOOLEAN);
    props[1].Value.b = TRUE;

    hr = pmsg->SetProps(sizeof(props) / sizeof(props[0]), props, NULL);
    // error handling here if hr < 0

    return hr;
}

Requirements

Header

mapidefs.h

Library

cemapi.lib

See Also

Reference

MAPI Macros
SPropValue