Solved

auto saving email with same subject heading to server directories

Posted on 2006-07-04
5
238 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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

733 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