Connecting Tech Pros Worldwide Help | Site Map

Outlook plugin to save mail in shared location

Member
 
Join Date: Jan 2008
Posts: 49
#1: Feb 5 '09
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
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 283
#2: Feb 9 '09

re: Outlook plugin to save mail in shared location


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?
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 283
#3: Feb 9 '09

re: Outlook plugin to save mail in shared location


a quick scribble code -

see here for some explanation -

http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub saveas()
  3. Dim MItem As Outlook.MailItem
  4.  
  5.  For Each ItemSelected In Application.ActiveExplorer.Selection
  6.  
  7.       If ItemSelected.Class = 43 Then
  8.           Set MItem = ItemSelected
  9.          MItem.saveas "c:\test.msg", olMSG
  10.  
  11.       End If
  12.  
  13.  Next tempc
  14.  
  15.  
  16. End Sub
  17.  
  18.  
Member
 
Join Date: Jan 2008
Posts: 49
#4: Feb 10 '09

re: Outlook plugin to save mail in shared location


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.
Member
 
Join Date: Jan 2008
Posts: 49
#5: Feb 10 '09

re: Outlook plugin to save mail in shared location


Also please tell me how to map this code to a button/control in outlook.
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 283
#6: Feb 10 '09

re: Outlook plugin to save mail in shared location


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

Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub saveas()
  3.  
  4. Dim MItem As Outlook.MailItem
  5. Dim checkover As String
  6.  
  7. Dim fso
  8. Set fso = CreateObject("Scripting.FileSystemObject")
  9.  
  10.  For Each ItemSelected In Application.ActiveExplorer.Selection
  11.  
  12.       If ItemSelected.Class = 43 Then
  13.  
  14.           Set MItem = ItemSelected
  15.  
  16.                  If Not fso.FileExists("c:\" + MItem.Subject + ".msg") Then
  17.                         MItem.saveas "c:\" + MItem.Subject + ".msg", olMSG
  18.                  Else
  19.  
  20.           checkover = MsgBox("Message already exists, do you wish to overwrite it?", vbYesNo)
  21.  
  22.                  If checkover = vbYes Then
  23.                          MItem.saveas "c:\" + MItem.Subject + ".msg", olMSG
  24.                  Else: MsgBox "Save Canceled!"
  25.                  End If
  26.  
  27.          End If
  28.  
  29.  
  30.       End If
  31.  
  32.  Next
  33.  
  34.  
  35. End Sub
  36.  
  37.  
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 283
#7: Feb 10 '09

re: Outlook plugin to save mail in shared location


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 :)
Member
 
Join Date: Jan 2008
Posts: 49
#8: Feb 11 '09

re: Outlook plugin to save mail in shared location


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 Thumbnails
macro.jpg  
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 283
#9: Feb 11 '09

re: Outlook plugin to save mail in shared location


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
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 283
#10: Feb 11 '09

re: Outlook plugin to save mail in shared location


also see -

http://msdn.microsoft.com/en-us/library/aa141471.aspx
Member
 
Join Date: Jan 2008
Posts: 49
#11: Feb 13 '09

re: Outlook plugin to save mail in shared location


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(counter)))
If intCounter > 0 And Not IsNull(intCounter) 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.
Member
 
Join Date: Jan 2008
Posts: 49
#12: Feb 13 '09

re: Outlook plugin to save mail in shared location


I have got the idea of how to distribute it.

Thanks
Member
 
Join Date: Jan 2008
Posts: 49
#13: Feb 13 '09

re: Outlook plugin to save mail in shared location


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
Member
 
Join Date: Jan 2008
Posts: 49
#14: Feb 14 '09

re: Outlook plugin to save mail in shared location


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


Similar Microsoft Windows / Vista / XP / ME / 95 & 98 bytes