Hi, I am working with Pocket PC 2003 and I want to delete all the messages stored in the Outbox. I have to use IMAPIFolder::DeleteMessages function but I am not sure about the parameters of this function. How can I get the ENTRYLIST that the function requires [in] Reference to an ENTRYLIST structure that contains the number of messages to delete and an array of ENTRYID structures identifying the messages; cannot be NULL. Has anyone used it before Thanks in advance

Deleted messages from Outbox
krymium
Hi there
I wrote some code like this in an SDK sample we shipped with Windows Mobile 5.0, of course since you are working on Pocket PC 2003 you may not have seen this sample.
The sample is called InboxMenuExtensibility and highlights new menu extensibility features in Windows Mobile 5.0 - but the functionality you want is there also.
To see the sample go to
http://msdn.microsoft.com/library/default.asp url=/library/en-us/mobilesdk5/html/mob5saminboxmenuextensions.asp
The key function you want, CreateEntryList, is listed below.
For info on how to create the SRowSet which is the input parameter - check the documentation on IMAPITable::QueryRows
http://msdn.microsoft.com/library/default.asp url=/library/en-us/mobilesdk5/html/mob5lrfimapitablequeryrows.asp
Note: the CHR / CPR / CBR macros are defined in the sample.
///////////////////////////////////////////////////////////////////////////////
// CreateEntryList
//
// This method will create an ENTRYLIST from an SRowSet which
//
// Arguments:
// [IN] SRowSet *pRows - a pointer the row set (obtained from an IMAPITable)
// [OUT] ENTRYLIST **ppList - the resulting new EntryList.
// NOTE: The caller is responsible for calling MAPIFreeBuffer
// on this returned list
//
// Return Values:
// HRESULT - S_OK on success
//
HRESULT CreateEntryList(SRowSet *pRows, ENTRYLIST **ppList)
{
HRESULT hr;
ENTRYLIST* plist = NULL;
// How much space do we need to create this entry list
ULONG cbNeeded = sizeof(SBinaryArray) + (pRows->cRows * (sizeof(SBinary)));
// Allocate one buffer to hold all the data for the list.
hr = MAPIAllocateBuffer(cbNeeded, (LPVOID*)&plist);
CHR(hr);
CPR(plist);
// Set the number of items in the EntryList
plist->cValues = pRows->cRows;
// Set plist->lpbin to the place in the buffer where the array items will be
// filled in
BYTE* pb;
pb = (BYTE*)plist;
pb += sizeof(SBinaryArray);
plist->lpbin = (SBinary*) pb;
// Loop through the list setting the contents of the EntryList to the contents
// of the incoming SRowSet
for (int cItems = 0; cItems < (int)plist->cValues; cItems++)
{
plist->lpbin[cItems].cb = pRows->aRow[cItems].lpProps[0].Value.bin.cb;
plist->lpbin[cItems].lpb = pRows->aRow[cItems].lpProps[0].Value.bin.lpb;
// Track our memory usage
pb += sizeof(SBinary);
}
// Make sure that we didn't write off the end of our buffer...
CBR(pb <= ((BYTE*)plist + cbNeeded));
Error:
if (FAILED(hr))
{
MAPIFreeBuffer(plist);
plist = NULL;
}
*ppList = plist;
return hr;
}
Good luck and happy coding!