Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   VB Macro fails on Digitally Signed Emails (http://www.outlookbanter.com/outlook-vba/7324-vb-macro-fails-digitally-signed.html)

Outlook Dabbler January 25th 06 09:32 PM

VB Macro fails on Digitally Signed Emails
 
Hi All, my VB macro in Outlook fails while accessing the body of digitally
signed emails. The following line,

mystring = MailItem.Body

fails giving error pop-up saying "Run-time error '-1040171007 (c2004001)':
The operation failed"

Can somebody pl give me a clue how to get around this ? thanks a bunch !


Ken Slovak - [MVP - Outlook] January 26th 06 03:25 PM

VB Macro fails on Digitally Signed Emails
 
You cannot read signed messages from Body it will return an error. Check the
message class of the item and if it's a signed or encrypted message skip it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Outlook Dabbler" Outlook wrote in
message ...
Hi All, my VB macro in Outlook fails while accessing the body of digitally
signed emails. The following line,

mystring = MailItem.Body

fails giving error pop-up saying "Run-time error '-1040171007 (c2004001)':
The operation failed"

Can somebody pl give me a clue how to get around this ? thanks a bunch !



Outlook Dabbler January 26th 06 04:19 PM

VB Macro fails on Digitally Signed Emails
 
Thanks Ken ! for replying back. I am using this Outlook VB code to load the
body of emails from our customers into our CRM application. Is there no way I
can get to the body of the digitally signed emails ? thanks..

regards,
Shiv Kotagal


"Ken Slovak - [MVP - Outlook]" wrote:

You cannot read signed messages from Body it will return an error. Check the
message class of the item and if it's a signed or encrypted message skip it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Outlook Dabbler" Outlook wrote in
message ...
Hi All, my VB macro in Outlook fails while accessing the body of digitally
signed emails. The following line,

mystring = MailItem.Body

fails giving error pop-up saying "Run-time error '-1040171007 (c2004001)':
The operation failed"

Can somebody pl give me a clue how to get around this ? thanks a bunch !




Ken Slovak - [MVP - Outlook] January 27th 06 03:59 PM

VB Macro fails on Digitally Signed Emails
 
Not from the Body or any of the other standard methods.

What you want is actually an attachment on the item. See
http://www.tech-archive.net/Archive/...5-01/0180.html
for a little more information about that.

Also see http://support.microsoft.com/?kbid=194623 for information about
detecting signed/encrypted information. It's a CDO 1.21 article but applies
to the Outlook object model also.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Outlook Dabbler" wrote in
message ...
Thanks Ken ! for replying back. I am using this Outlook VB code to load
the
body of emails from our customers into our CRM application. Is there no
way I
can get to the body of the digitally signed emails ? thanks..

regards,
Shiv Kotagal



JackTF March 13th 14 10:49 AM

Quote:

Originally Posted by Outlook Dabbler (Post 22096)
Thanks Ken ! for replying back. I am using this Outlook VB code to load the
body of emails from our customers into our CRM application. Is there no way I
can get to the body of the digitally signed emails ? thanks..

regards,
Shiv Kotagal


"Ken Slovak - [MVP - Outlook]" wrote:

You cannot read signed messages from Body it will return an error. Check the
message class of the item and if it's a signed or encrypted message skip it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Outlook Dabbler" Outlook wrote in
message ...
Hi All, my VB macro in Outlook fails while accessing the body of digitally
signed emails. The following line,

mystring = MailItem.Body

fails giving error pop-up saying "Run-time error '-1040171007 (c2004001)':
The operation failed"

Can somebody pl give me a clue how to get around this ? thanks a bunch !



I've found a solution: you have to forward the mail once before accessing the body:

_MailItem newMail = ((_MailItem)eMail).Forward();
newMail.Close(OlInspectorClose.olDiscard);
newMail = null;

After it the mail is opened in ui mode and all properties can be accessed.


All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com