R
RDA
When I run the below snippet of code on a Vista Enterprise box using
Outlook 2007, the following error occurs:
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in MyApp.exe.
Additional information: Operation aborted {Exception from HRESULT:
0x80004004 (E_ABORT)}"
The snippet is below and the line where the error occurs is
commented.
I would appreciate any support, tips, or advice. Thanks.
////begin code/////
private void ProcessPosts(MAPIFolder oFldr, MAPIFolder
oDestFldr)
{
int iAttachCnt = 0;
//cycle through each email, filtering out only posts, no
personal emails, calendars, or tasks
string filter = "[MessageClass] = \"IPM.Post\"";
Microsoft.Office.Interop.Outlook.Items oTestItems =
oFldr.Items.Restrict(filter);
for (int i = oTestItems.Count; i > 0; i--)
{
Status("Cycling through discussion email...", 10);
//get post message
PostItem oMessage = (PostItem)oTestItems;
//move email
oMessage.Move(oDestFldr);
//get attachment count
iAttachCnt = oMessage.Attachments.Count;
//declare subject variable
string strSubject;
//determine if subject is null and set variable
accordingly
if (oMessage.Subject == null)
{
strSubject = "";
}
else
{
strSubject = oMessage.Subject.ToString();
}
//create emails GUID for table
Guid tmpEmID = Guid.NewGuid();
//ERROR OCCURS HERE at "oMessage"
string sem = oMessage.SenderEmailAddress.ToString();
/////end code////
Outlook 2007, the following error occurs:
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in MyApp.exe.
Additional information: Operation aborted {Exception from HRESULT:
0x80004004 (E_ABORT)}"
The snippet is below and the line where the error occurs is
commented.
I would appreciate any support, tips, or advice. Thanks.
////begin code/////
private void ProcessPosts(MAPIFolder oFldr, MAPIFolder
oDestFldr)
{
int iAttachCnt = 0;
//cycle through each email, filtering out only posts, no
personal emails, calendars, or tasks
string filter = "[MessageClass] = \"IPM.Post\"";
Microsoft.Office.Interop.Outlook.Items oTestItems =
oFldr.Items.Restrict(filter);
for (int i = oTestItems.Count; i > 0; i--)
{
Status("Cycling through discussion email...", 10);
//get post message
PostItem oMessage = (PostItem)oTestItems;
//move email
oMessage.Move(oDestFldr);
//get attachment count
iAttachCnt = oMessage.Attachments.Count;
//declare subject variable
string strSubject;
//determine if subject is null and set variable
accordingly
if (oMessage.Subject == null)
{
strSubject = "";
}
else
{
strSubject = oMessage.Subject.ToString();
}
//create emails GUID for table
Guid tmpEmID = Guid.NewGuid();
//ERROR OCCURS HERE at "oMessage"
string sem = oMessage.SenderEmailAddress.ToString();
/////end code////