Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can't add person to Distribution list in the GAL

1 view
Skip to first unread message

jha...@gmail.com

unread,
Feb 16, 2007, 8:11:55 PM2/16/07
to
Hey!

There is a MS knowledge base in this area:
http://support.microsoft.com/kb/225106/en-us
http://support.microsoft.com/kb/197191

But I still can't get this to work. I'm getting the entry ID for the
distribution list and the person from the GAL's content tables:

SizedSPropTagArray ( 2, sptCols ) = { 2, PR_ENTRYID, PR_ACCOUNT };
if(FAILED(hr = lpGAL->GetContentsTable(0L, &lpContentsTable)))
{
return hr;
}

//Retreive the data in the SRowSet Array
if ( FAILED ( hr = HrQueryAllRows (lpContentsTable,(SPropTagArray*)
&sptCols, NULL, NULL, 0,&pRow)))
{
return hr;
}

for(size_t x=0; x < pRow->cRows ;x++)
{
findName( pRow->aRow[x].lpProps[1].Value.lpszA, (ULONG) pRow-
>aRow[x].lpProps[0].Value.bin.cb, (char *)pRow-
>aRow[x].lpProps[0].Value.bin.lpb );
}

I've checked the EntryID's here - they match what I see in
OutlookSpy. I then try to add them:

LPABCONT lpDistList = NULL;
ULONG ulObjType;
IID Interface = IID_IABContainer;
if(FAILED(hr = m_pAddrBook->OpenEntry(elementsToFind[i]->m_toAdd-
>m_entryLength, (ENTRYID *)elementsToFind[i]->m_toAdd->m_entryData,
&Interface,MAPI_MODIFY,&ulObjType,(LPUNKNOWN
*)&lpDistList)))
{
printMessage("Failed to open %s\n", elementsToFind[i]->m_toAdd-
>m_uniqueName );
return -1;
}

SPropTagArray taga = {1, {PR_ACCESS_LEVEL }}; // Props to
return from GetProps.
ULONG ulCount = 0;
LPSPropValue lpDistListProps = NULL;
if (FAILED(hr = lpDistList->GetProps(&taga, NULL, &ulCount,
&lpDistListProps)))
{
return hr;
}
/**** HR BACK == MAPI_W_ERRORS_RETURNED 40380 263040 ***/
/** the value back is MAPI_E_NOT_FOUND = 8004010 **/

MAPIERROR *whatWentWrong;
pSession->GetLastError( hr, 0, &whatWentWrong );

/*** whatWentWrong is NULL. ***/

if ( ulObjType == MAPI_DISTLIST )
{

LPMAPIPROP lpNewEntry = NULL;
hr = lpDistList->CreateEntry( elementsToFind[i]->m_entryLength,
(ENTRYID *)elementsToFind[i]->m_entryData,
CREATE_CHECK_DUP_LOOSE,
&lpNewEntry);

/*** HR is MAPI_E_NO_SUPPORT 0x80040102 ***/

I'm sure I'm missing something.

There is a related thread in the past:
http://groups.google.ca/group/microsoft.public.win32.programmer.messaging/browse_thread/thread/bb4b1d7407ebd861/262d340a2b7973e5?lnk=st&q=CreateEntry+Distribution+list+error+MAPI&rnum=2&hl=en#262d340a2b7973e5

But in this case, they weren't accessing the global distribution
lists.

Any pointers appreciated.

John

0 new messages