Outlook plugin to save mail in shared location

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • plsHelpMe
    New Member
    • Jan 2008
    • 58

    Outlook plugin to save mail in shared location

    Hi All,

    I need to have a MS outlook plugin using which i can move any mail to a shared location on the LAN. It would really be great if someone can direct me to the same. Or is there any easy way to code the same of my own.

    TIA
  • jg007
    Contributor
    • Mar 2008
    • 283

    #2
    will a vba macro do? when you say plug in, I have several macro's assigned to buttons in outlook for moving / forwarding and doing things with groups of emails

    it depends how you are looking to move them, do you want to select a group of them and press a button , do you want a rule that runs when they are delivered or something else?

    Comment

    • jg007
      Contributor
      • Mar 2008
      • 283

      #3
      a quick scribble code -

      see here for some explanation -



      Code:
      Sub saveas()
      Dim MItem As Outlook.MailItem
      
       For Each ItemSelected In Application.ActiveExplorer.Selection
            
            If ItemSelected.Class = 43 Then
                Set MItem = ItemSelected
               MItem.saveas "c:\test.msg", olMSG
               
            End If
             
       Next tempc
             
             
      End Sub

      Comment

      • plsHelpMe
        New Member
        • Jan 2008
        • 58

        #4
        Thanks jg007,

        M looking for any code/VBA using which i can see any control in my outlook, and when i select any mail and click on this control the selected item should be copied to a pre-specified location on LAN, such that any other search engine can then index that. I would try with the code you have already published. If you have any other approach for the same please let me know.

        Comment

        • plsHelpMe
          New Member
          • Jan 2008
          • 58

          #5
          Also please tell me how to map this code to a button/control in outlook.

          Comment

          • jg007
            Contributor
            • Mar 2008
            • 283

            #6
            I have amended the code slightly, as I have it it save the message with the subject , if it is there already it asks if you want to overwrite it, that is not really the best way of doing it as you may have several messages with the same name but I will leave it to you to decide how you want to handle that

            to use a macro as a button, right click the toolbar and select customise then commands, scroll to macro's and then just drag the macro to the toolbar , if you want to change the icon or name just right click the icon in the task bar while you are on the customise menu, the options are pretty much self explanatory

            Code:
            Sub saveas()
            
            Dim MItem As Outlook.MailItem
            Dim checkover As String
            
            Dim fso
            Set fso = CreateObject("Scripting.FileSystemObject")
            
             For Each ItemSelected In Application.ActiveExplorer.Selection
                  
                  If ItemSelected.Class = 43 Then
                    
                      Set MItem = ItemSelected
                   
                             If Not fso.FileExists("c:\" + MItem.Subject + ".msg") Then
                                    MItem.saveas "c:\" + MItem.Subject + ".msg", olMSG
                             Else
                             
                      checkover = MsgBox("Message already exists, do you wish to overwrite it?", vbYesNo)
            
                             If checkover = vbYes Then
                                     MItem.saveas "c:\" + MItem.Subject + ".msg", olMSG
                             Else: MsgBox "Save Canceled!"
                             End If
                      
                     End If
                     
                     
                  End If
                   
             Next
                   
                   
            End Sub

            Comment

            • jg007
              Contributor
              • Mar 2008
              • 283

              #7
              please remember that the code I have posted is not perfect or complete but is more a guidance for how you can do it, also if you google you may find better code :)

              Comment

              • plsHelpMe
                New Member
                • Jan 2008
                • 58

                #8
                Thanks Buddy for your quick reply, I tried your code, but i saw an error msg as shown in the attached snapshot. Seems macros are not enabled. I did lots of googling to enable these but couldn't find a workaround. I have tried "Security lavel settings" and "Digital certificates". Would be great if you have anything for the same.

                Thanks
                Attached Files

                Comment

                • jg007
                  Contributor
                  • Mar 2008
                  • 283

                  #9
                  depending on your version of office you will need to run something like -

                  C:\Program Files\Microsoft Office\OFFICE11 \selfcert.exe

                  you will then create a self certified certificate for yourcode and you can then go to 'tools ' and then ' digital signature ' , as selfcert will show, the certificate is not valid for distribution

                  Comment

                  • jg007
                    Contributor
                    • Mar 2008
                    • 283

                    #10
                    also see -

                    Comment

                    • plsHelpMe
                      New Member
                      • Jan 2008
                      • 58

                      #11
                      Thanks a lot buddy for your help,
                      The macro is working fine. I have made the following change in the code published by you in order to take care of the special characters in the subject of the mail
                      <code>
                      charList = Array(92, 47, 58, 42, 63, 34, 60, 62, 124)
                      For counter = 0 To UBound(charList )
                      intCounter = 1
                      Do Until intCounter = 0

                      intCounter = InStr(1, subj, Chr(charList(co unter)))
                      If intCounter > 0 And Not IsNull(intCount er) Then
                      Mid(subj, intCounter, 1) = " "
                      End If
                      </code>

                      Also, i know i am asking lots of questions, but could you please tell me if we can distribute this macro somehow such that the code is not visible to the recipients.

                      Comment

                      • plsHelpMe
                        New Member
                        • Jan 2008
                        • 58

                        #12
                        I have got the idea of how to distribute it.

                        Thanks

                        Comment

                        • plsHelpMe
                          New Member
                          • Jan 2008
                          • 58

                          #13
                          Hi,
                          Got one more question :)
                          I want to display few options to the user using the combo box (Using same macro) such that when user selects some value from the combobox the corresponding activity can take place. It would be great if you can share something on How i can display a combobox using outlook macro

                          Comment

                          • plsHelpMe
                            New Member
                            • Jan 2008
                            • 58

                            #14
                            Thanks buddy, this is done. Thanks a lot for all your help

                            Comment

                            Working...