首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Windows Mobile >

MAPI 移动短信到回收站,该怎么解决

2012-03-17 
MAPI 移动短信到回收站我现在要做短信过滤的功能,在收到新短信的时候把它移动到回收站。用MAPI怎么写移动短

MAPI 移动短信到回收站
我现在要做短信过滤的功能,在收到新短信的时候把它移动到回收站。用MAPI怎么写移动短信这段,最好能贴一段Code,谢谢大家~~

[解决办法]
pSubFolder = GetFolder(pMsgStore, PR_CE_IPM_DRAFTS_ENTRYID, &cbDestFolder,&lpDestFolder);
if (pSubFolder)
{
ENTRYLIST lst;
SBinary sbin;
sbin.cb = cbMsg;
sbin.lpb = (LPBYTE)lpMsg;
lst.cValues = 1;
lst.lpbin = &sbin;
if (lpDestFolder)
hr = pFolder-> CopyMessages(&lst, 0, pSubFolder, NULL, NULL, MESSAGE_MOVE);

[解决办法]
我已经试过了,这个可以。

RESULT hr = S_OK;
ENTRYLIST lst;
SBinary sbin;
IMAPIFolder *pFolder = NULL;

// Delete it
hr = pMsgStore-> OpenEntry(cbDestFolder, lpDestFolder, NULL, 0, NULL, (LPUNKNOWN *)&pFolder);
if (FAILED(hr))
{
RETAILMSG(TRUE, (TEXT( "Couldn 't get the folder!\r\n ")));
goto Exit;
}

ULONG ulValues = 0;
LPMAPIFOLDER* pWasteFolder;
LPSPropValue rgprops = NULL;
ULONG rgTags[] = {1, PR_IPM_WASTEBASKET_ENTRYID};

pMsgStore-> GetProps((LPSPropTagArray) rgTags, MAPI_UNICODE, &ulValues, &rgprops);

pMsgStore-> OpenEntry(rgprops[0].Value.bin.cb, (LPENTRYID)rgprops[0].Value.bin.lpb, NULL, MAPI_MODIFY, NULL, (LPUNKNOWN*)&pWasteFolder);
MAPIFreeBuffer(rgprops);

lst.cValues = 1;
sbin.cb = cbMsg;
sbin.lpb = (LPBYTE) lpMsg;
lst.lpbin = &sbin;

hr = pFolder-> CopyMessages(&lst, NULL, pWasteFolder, 0, NULL, MESSAGE_MOVE);

*pulEventType = fnevObjectDeleted;
*pHandled = MRC_HANDLED_DONTCONTINUE;

Exit:
if (pFolder)
{
pFolder-> Release();
}

return hr;

热点排行