Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

The CHANGE_PROP_TYPEmacro updates the property type of a property tag to a specified value. 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_TYPEallows 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.
Copy Code
HRESULT SMS_SetMsgProps(LPMESSAGE pmsg)
{
	SPropValue  rgprops[8]	= {0};
	ULONG	 cProps		= 0;
	LPSTREAM	pstm			= NULL;
	TCHAR	 szwSubject[500] = SUBJECT_LINE;
	HRESULT	 hr;
	// Setup recipients.
	hr = CEMAPI_SetMessageRecipients(pmsg);
	EXIT_ON_FAILED(hr);
	// Set the flags and a subject.
	rgprops[cProps].ulPropTag = PR_MESSAGE_CLASS;
	rgprops[cProps].Value.lpszW = L"IPM.SMStext.Msg";
	++cProps;
	GUID guid;
	guid.Data1 = 0x00020328; // PS_MAPI
	guid.Data2 = 0;
	guid.Data3 = 0;
	guid.Data4[0] = 0xC0;
	guid.Data4[1] = 0x0;
	guid.Data4[2] = 0x0;
	guid.Data4[3] = 0x0;
	guid.Data4[4] = 0x0;
	guid.Data4[6] = 0x0;
	guid.Data4[6] = 0x0;
	guid.Data4[7] = 0x46;
	MAPINAMEID NamedMsgProps[1] = {0};
	NamedMsgProps[0].lpguid  = &guid;
	NamedMsgProps[0].ulKind  = MNID_STRING; 
	NamedMsgProps[0].Kind.lpwstrName =
const_cast<LPWSTR>(L"SMS:Unicode");
	MAPINAMEID* pNames = NamedMsgProps;
	LPSPropTagArray lppPropTags = NULL;
	HRESULT hrp =
pmsg->GetIDsFromNames(ARRAYSIZEOF(NamedMsgProps), &pNames,
MAPI_CREATE, &lppPropTags);

	if((hrp == S_OK) || (hrp == MAPI_W_ERRORS_RETURNED) )
//MAPI_W_ERRORS_RETURNED;
	{ 
		MessageBox(NULL,L"Success", L"GetIDsFromNames",MB_OK);
		ULONG *pulPropTag = lppPropTags[0].aulPropTag;
		// The return values from GetIDsFromNames are property IDs
that do not yet have a type associated with them.
		// The type informatio must be added to get the final tag.
	
		rgprops[cProps].Value.b = true;
		++cProps;
}
	else
	{
		MessageBox(NULL,L"Failure", L"GetIDsFromNames",MB_OK);
}
	rgprops[cProps].ulPropTag = PR_MSG_STATUS;
	rgprops[cProps].Value.ul = MSGSTATUS_RECTYPE_SMS;
	++cProps;
	rgprops[cProps].ulPropTag = PR_MESSAGE_FLAGS;
	rgprops[cProps].Value.ul  = MSGFLAG_UNSENT;  // MSGFLAG_FROMME
| MSGFLAG_UNSENT.
	++cProps;
	if (szwSubject != NULL)
	{
		rgprops[cProps].ulPropTag   = PR_SUBJECT_W;
		rgprops[cProps].Value.lpszW = szwSubject;
		++cProps;
}
	rgprops[cProps].ulPropTag   = PR_MESSAGE_CLASS;
	rgprops[cProps].Value.lpszW =
const_cast<LPTSTR>(L"IPM.SMStext");
	++cProps;
	// Apply the property values to this message.
	hr = pmsg->SetProps(cProps, // count of property
						rgprops,   // an array of property
						NULL);
	EXIT_ON_FAILED(hr);
FuncExit:
	return hr;
}

Requirements

Header mapidefs.h
Library cemapi.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC 2002 and later, Smartphone 2002 and later

See Also

Reference

MAPI Macros
SPropValue

Other Resources

Messaging