Article ID: 165931
Article Last Modified on 8/18/2005
sDAPIParms.pszDSAName = "EXCHANGE_SERVER";
sDAPIParms.pszBasePoint = NULL;
sDAPIParms.pszContainer = NULL;
sDAPIParms.pszNTDomain = "EXCHANGE_SERVER";
sDAPIParms.dwFlags = DAPI_MODIFY_REPLACE_PROPERTIES;
sDAPIParms.dwDAPISignature = DAPI_SIGNATURE;
pDAPIEvent = DAPIStart(
&hDAPISession,
&sDAPIParms);
if (pDAPIEvent != NULL)
goto cleanup;
hr = MAPIAllocateBuffer(sizeof(DAPI_ENTRY), (LPVOID*) &pValues);
if (FAILED(hr))
{
goto cleanup;
}
ZeroMemory(pValues, sizeof(DAPI_ENTRY));
hr = MAPIAllocateBuffer(sizeof(DAPI_ENTRY), (LPVOID*) &pAttributes);
if (FAILED(hr))
{
goto cleanup;
}
ZeroMemory(pAttributes, sizeof(DAPI_ENTRY));
pAttributes->unAttributes = 1;
pAttributes->ulEvalTag = TEXT_LINE;
hr = MAPIAllocateMore(
cDAPIArrayElements * sizeof(ATT_VALUE),
pAttributes,
(LPVOID*) &pAttributes->rgEntryValues);
if (FAILED(hr))
{
goto cleanup;
}
ZeroMemory(
pAttributes->rgEntryValues,
cDAPIArrayElements * sizeof(ATT_VALUE));
pAttributes->rgEntryValues[0].DapiType = DAPI_TEXT;
pAttributes->rgEntryValues[0].Value.pszValue = "Obj-Class,
E-mail address,Directory Name,Alias Name,obj-container,
Display name,First Name,Last Name";
pAttributes->rgEntryValues[0].size =
strlen(pAttributes->rgEntryValues[0].Value.pszValue);
pValues->unAttributes = 1;
pValues->ulEvalTag = TEXT_LINE;
hr = MAPIAllocateMore(
cDAPIArrayElements * sizeof(ATT_VALUE),
pValues,
(LPVOID*) &pValues->rgEntryValues);
if (FAILED(hr))
{
goto cleanup;
}
ZeroMemory(
pValues->rgEntryValues,
cDAPIArrayElements * sizeof(ATT_VALUE));
pValues->rgEntryValues[0].DapiType = DAPI_TEXT;
pValues->rgEntryValues[0].Value.pszValue =
"Remote,SMTP:USER1@cate.com,usertest,usertest,Recipients,
User Test,User,Test";
pValues->rgEntryValues[0].size =
strlen(pValues->rgEntryValues[0].Value.pszValue);
ulNewUSN = 0;
pDAPIEvent = DAPIWrite(
hDAPISession,
dwWriteFlags,
pAttributes,
pValues,
&ulNewUSN,
NULL,
NULL);
MAPIFREEBUFFER(pValues);
MAPIFREEBUFFER(pAttributes);
DAPIEnd(hDAPISession);
Keywords: kbhowto kbapi kbmsg kbfaq kbcode KB165931