I need to extrac each messages to files. I am using CDO, redemption to get those messages out.
However, when the applicaiton processes messages till 1200+. My application responses "MAPI session time out". How to hold the Mapi sesssion? I am using CDO to create MAPI.session.
I need to process large .pst files and contains thousands of messages. Any possibility?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Roger" <anon...@discussions.microsoft.com> wrote in message
news:C1FE528D-F966-4B38...@microsoft.com...
Failed to add MAPI message [Collaboration Data Objects - [E_OUTOFMEMORY(8007000E)]]
Here is what I did.
MAPILogonEx() to logon session in a service
Get Inbox Folder ptr using CDO
Start to process folders in Inbox
( Use Redemption to get each message and then create RFC822 files)
The applicaiton always stops when it processes to message 1100 - 1200.
Any clue?
the program stops when it processes Mesasge No 1200+.
Redemption::ISafeMailItemPtr sItem;
hr = m_SafeMailItemFactory->CreateInstance(NULL, __uuidof(Redemption::ISafeMailItem), (void**)&sItem);
for (int i=1; i<= MsgCount; i++)
{
CurrentMsg = msgs->GetNext();
hr = sItem->put_Item(CurrentMsg);
hr = sItem->raw_SaveAs(_bstr_t(MsgFile), _variant_t((long)Redemption::olRFC822));
}
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Roger" <anon...@discussions.microsoft.com> wrote in message
news:50D73B28-4BB4-4237...@microsoft.com...
I will have more test on it this weekend.
Also, if the error is really caused by GetNext(), will it be possible to use Redemption?
Here is an example of my current pst file.
- Inbox (728 message)
- test1 (488 messages)
- test2 (720 mesages) --> My application will fail here.
Actually, my application can't process the message over 1650. It fails at the message each time.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Roger" <anon...@discussions.microsoft.com> wrote in message
news:60415E0A-1F3C-424E...@microsoft.com...
So, here is my old code:
//this is the code I want to replace:
CComPtr<Outlook::_NameSpace> spNS;
HRESULT hr = m_spApp->GetNamespace(T2W("MAPI"), &spNS);
CComPtr<Outlook::MAPIFolder> spContacts;
hr = spNS->GetDefaultFolder(olFolderContacts, &spContacts);
if(FAILED(hr))
return false;
CComPtr<Outlook::_Items> spItms;
hr = spContacts->get_Items(&spItms);
if(FAILED(hr))
return false;
CComPtr<IDispatch> spFirstItem;
hr = spItms->GetFirst(&spFirstItem);
if(FAILED(hr))
return false;
CString strTmp;
while(spFirstItem != NULL) //there are still addresses here
{
CComQIPtr<Outlook::_ContactItem> spFirstContactItem(spFirstItem);
//HOW DO I DO THIS IN THE CODE USING REDEMPTION???
BSTR emailAddress;
hr = spFirstContactItem->get_Email1Address(&emailAddress);
if(FAILED(hr))
return false;
strTmp = W2T(emailAddress);
if(!strTmp.IsEmpty())
m_saWhiteList.Add(strTmp);
spFirstItem.Release();
bFirstLoop = false;
hr = spItms->GetNext(&spFirstItem);
if(FAILED(hr))
break;
}
Now, I thought that I could use this instead:
...bla-bla
CComPtr<IDispatch> spFirstItem;
hr = spItms->GetFirst(&spFirstItem);
if(FAILED(hr))
return false;
ISafeContactItemPtr pSafeContact;
CLSID clsid;
if ((hr = ::CLSIDFromProgID(L"Redemption.SafeContactItem", &clsid)) !=
NOERROR)
{
return false;
}
if ((hr = ::CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
__uuidof(ISafeContactItem),
(void**)&pSafeContact)) != S_OK)
{
return false;
}
//HERE IS THE PROBLEM: How do I bound the info I have in spFirstItem, to
pSafeContact. In the old code, I only had to do this:
CComQIPtr<Outlook::_ContactItem> spFirstContactItem(spFirstItem);
CString strTmp;
if(pSafeContact != NULL)
{
BSTR emailAddress;
hr = pSafeContact->get_Email1Address(&emailAddress);
if(FAILED(hr))
return false;
strTmp = W2T(emailAddress);
bla-bla...
}
I hope I wasn't to complicated :) Actually, all I want to know is how do
I bound spFirstItem to pSafeContact. Thank you!
Doru K.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
pSafeContact->put_Item(spFirstContactItem);
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Doru K" <blue...@fake.com> wrote in message
news:eDCdYda$DHA....@TK2MSFTNGP09.phx.gbl...