Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

auto saving email with same subject heading to server directories

Posted on 2006-07-04
5
Medium Priority
?
242 Views
Last Modified: 2010-04-08
not sure exactly what category this should come under but i'll start here. I have a user who gets a lot of email from newsgroups. he saves these to general directories on a win2k3 server. we no longer maintain our exchange/public folders for this so he has to store these on one of our servers so others can search through them. a solution we need is one that can overcome the issue of saving messages that have the same subject heading to directories versus moving them to exchange public folders (which was a lot easier). Outlook seems limited in it's rules language to accomplish this.
0
Comment
Question by:demus619
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 17038289
Hi demus619,

This would require some VBA code that would check to see if a file with a matching name already exists and, if so, rename it or append a sequence number to it.  I can post code for doing this if this sounds like an option.

Cheers!
0
 

Author Comment

by:demus619
ID: 17043202
sure, post it, would be worth viewing and appreciated it.  
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 17046875
Ok, here it is.  This macro can be hooked directly to a rule.  When the rule fires it triggers the macro which saves the message to disk using the subject as the file name.  If a file with that name already exists in the save to folder, then the code will add "(1)" to the file name and attempt to save it again.  If that file name has already been used, then it'll change "(1)" to "(2)" and try again.  It will keep adding one to the number until there is no matching file at which point the message is saved with that name.  There is one hitch to this process.  Saving a message to disk is going to trigger Outlook's built in security, causing a dialog-box to pop up warning that a program is accessing your mailbox and asking for permission to allow it to continue.  There are four ways around this.

1.  Sign the code using a digital certificate.  If you don't have a certificate, then you can use a self-cert.  Here are instructions for doing that: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_dsvba.asp

2.  Use Click-Yes.  This is a small utility that sits in the system tray and clicks the "yes" button for you when Outlook's security pop-up appears.  http://www.contextmagic.com/express-clickyes/

3.  Outlook Redemption.  This is a DLL that safely circumvents Outlook security.  The code would have to be re-written to use Redemption.  http://www.dimastr.com/redemption

4.  Re-write the code to be an Outlook add-in.  Add-ins have different security rules.  THey are also more difficult to write.

Follow these instructions to use the code.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Modules and click on Module1
4.  Copy the code below and paste it into the right-hand pane of the VB editor window
5.  Edit the code as needed.  I placed comment lines where things need to be changed
6.  Click the diskette icon on the toolbar to save changes
7.  Close the VB Editor
8.  Click Tools->Macro->Security
9.  Set the Security Level to Medium
10.  Create a new rule.
11.  Set the rule to fire on every message
12.  Set the rule's action to "run a script"
13.  Select the macro named Module1.SaveMessageToFileSystem as the target script

Sub SaveMessageToFileSystem(Item As Outlook.MailItem)
    Dim strSaveToPath As String, _
        strFilename As String, _
        intCount As Integer, _
        objFSO As Object
    'Change the path on the following line
    strSaveToPath = "C:\eeTesting\"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strFilename = Replace(Replace(Item.Subject, ":", ""), "\", "")
    intCount = 1
    Do While True
        If objFSO.FileExists(strSaveToPath & strFilename & ".txt") Then
            strFilename = objFSO.GetBaseName(Item.Subject) & "(" & intCount & ")"
            intCount = intCount + 1
        Else
            Item.SaveAs strSaveToPath & strFilename & ".txt", olTXT
            Exit Do
        End If
    Loop
    Set objFSO = Nothing
End Sub
0
 

Author Comment

by:demus619
ID: 17048104
OK, thanks. i will test this tomorrow at work and assign points then. Opts 1 & 2 look practical for us. I'll get back to  you tomorrow. thanks!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17055003
You're welcome.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

609 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