Solved

Silently save digitally signed message to disk

Posted on 2015-01-13
9
622 Views
Last Modified: 2015-01-28
I am using  vba in outlook 2010

When I try to save a digitally signed message to disk, outlook sends a warning message.

You have changed this message. If you save the changes, the message will no longer be digitally signed. Do you want to save your changes?

I want to save the message to disk without any changes. How can I do that?

Dim item As mailItem
    For Each item In ActiveExplorer.Selection
        item.SaveAs "c:\aatmp\test642.msg", olMsg
    Next
End Sub

Open in new window

0
Comment
Question by:rberke
  • 5
  • 4
9 Comments
 
LVL 14

Expert Comment

by:DrTribos
ID: 40548026
I think you would have to close the file then copy it to your preferred location... saving, as I understand it, will save changes.  You can, perhaps, make use of close without saving, or write the content of the file to another location.

I think the approach I would use depends on whether or not it is important to retain the certificate.
0
 
LVL 5

Author Comment

by:rberke
ID: 40548186
I am saving the contents of my email archive to disk.

99% of the saves work fine, but the program fails when the archive contains a digitally signed email.

As a workaround, i log the troublesome emails, and skip them.

Any body have code that will get around the problem?

Everything I try keeps coming up with "you have changed the message ...".
0
 
LVL 5

Accepted Solution

by:
rberke earned 0 total points
ID: 40549518
the problem occurred when a client sent me a digitally signed email. Until this happened, I had never had any interaction with digital signed emails.

But, I decided to get a little experience, so I went to Comodo.com and installed a free digital signature on my computer and changed the outlook configuration to allow me to sign my own messages.

Strangely enough, the .saveas problem has now gone away  !!! I am able to save the message to disk with no problem.

I believe the change to outlook configuration allowed the code to work.

Perhaps one of you experts can test this for me.

open the attached zip, and copy the .msg file into outlook.  Select that message and run the code in my initial post.

If the code gives you the warning message, I'll give you a share of the points.
signed-msg-file.zip
0
 
LVL 14

Assisted Solution

by:DrTribos
DrTribos earned 500 total points
ID: 40549907
Hmmm interesting... I have not used VBA in OutLook before so decided to dip my big toe in...

I get RTE -2147287037 (80030003) The operation failed.

I did not have a dir with the name specified so I just used c:\tmp instead, then it worked

The macro ran w/o issues.

I have confirmed that the message was copied to the tmp folder.  I will disclose that I already had my own digital signature for code signing (GoDaddy) - however I don't use outlook and can guarantee that I have not changed any outlook specific settings on this PC to work with signatures (MS Word is a different story and that could impact all of Office).

Hope this helps.

Option Explicit

Sub Robert()
Dim item As MailItem
    For Each item In ActiveExplorer.Selection
        item.SaveAs "c:\tmp\test642.msg", olMSG
    Next
End Sub

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Author Comment

by:rberke
ID: 40550191
Thanks for your input.

Summary so far:
1) my laptop uses Outlook 2010 and originally gave the error message
2) after installing a signature and reconfiguring Outlook, the error message went away.
3) A desktop computer with outlook 2003, no signatures and no reconfigurations does give the error message.
4) I will install a signature on that computer and see what happens. That will be definitive, but it might be a day or two before I get around to it.

DrTribos recent post adds the following
5) DrTribos has a computer with signatures installed, His does not give the error message even though Outlook has not be reconfigured.

rberke
0
 
LVL 14

Expert Comment

by:DrTribos
ID: 40550210
No worries, I don't think I can add much more as I don't really have suitable test environments. But the behavior you describe seems odd to me! Nothing new, just saying!
0
 
LVL 14

Expert Comment

by:DrTribos
ID: 40567729
Thanks, glad you got it working.
0
 
LVL 5

Author Closing Comment

by:rberke
ID: 40574821
DrTribos gets points for confirming that my code works on his Windows 7 computer even though it did not work on mine.

But, I "fixed" my Windows 7 computer by installing a first digital email certificate.  That idea was mine, so I am awarding myself the best answer.

In a few months, I will check to see if the "fix" also works on another computer with windows XP, but that computer cannot be touched right now.
0
 
LVL 14

Expert Comment

by:DrTribos
ID: 40574855
Thanks - glad to contribute
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction It seems that at least a couple of times per month, I answer a question that requires automating Outlook from another Microsoft Office application, usually (although not always) to send one or more email messages.  For example: …
Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now