Solved

Silently save digitally signed message to disk

Posted on 2015-01-13
9
676 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 15

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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 15

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
 
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 15

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 15

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 15

Expert Comment

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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction Perhaps more familiar to developers who primarily use VBScript than to developers who tend to work only with Microsoft Office and Visual Basic for Applications (VBA), the Dictionary is a powerful and versatile class, and is useful …
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

785 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