473,513 Members | 2,881 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Outlook plugin to save mail in shared location

58 New Member
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
Feb 5 '09 #1
13 3685
jg007
283 Contributor
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?
Feb 9 '09 #2
jg007
283 Contributor
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.  
Feb 9 '09 #3
plsHelpMe
58 New Member
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.
Feb 10 '09 #4
plsHelpMe
58 New Member
Also please tell me how to map this code to a button/control in outlook.
Feb 10 '09 #5
jg007
283 Contributor
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.  
Feb 10 '09 #6
jg007
283 Contributor
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 :)
Feb 10 '09 #7
plsHelpMe
58 New Member
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 Images
File Type: jpg macro.jpg (16.7 KB, 220 views)
Feb 11 '09 #8
jg007
283 Contributor
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
Feb 11 '09 #9
jg007
283 Contributor
also see -

http://msdn.microsoft.com/en-us/library/aa141471.aspx
Feb 11 '09 #10
plsHelpMe
58 New Member
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.
Feb 13 '09 #11
plsHelpMe
58 New Member
I have got the idea of how to distribute it.

Thanks
Feb 13 '09 #12
plsHelpMe
58 New Member
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
Feb 13 '09 #13
plsHelpMe
58 New Member
Thanks buddy, this is done. Thanks a lot for all your help
Feb 14 '09 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1848
by: Eric Nelson | last post by:
Experienced, but first time outlook programmer asks... Each day I get an e-mail containing a gzipped tar archive as an attachment. I'd like an automated way to (1) save the archive as-is in a particular folder and (2) unpack the archive with gunzip & tar, either directly from the mail message or from its saved location in step 1. Sorry to...
6
2104
by: Adam Clauss | last post by:
I would like to create a plugin for Outlook Express using C# (could also use C++ if it is not available in C#). Any ideas on how I would go about starting this? Thanks!
1
4881
by: Joey Lee | last post by:
Hi, I am trying to send mail thru outlook. I have found some code on the web and ws trying it out. I was successful in creating a mail in the draft folder of outlook, however hangs for a long time during the sending of the mail. Snippet code as below ------------------------------------------- using Outlook =...
8
2675
by: Li Pang | last post by:
Hi, I used following codes to pass a message item from CDO to Outlook. They worked fine when I used outlook 2000, but get an error of "Specified cast is not valid." when I used Outlook 2003. Anybody has an ideal? Dim outlookMsg AsMicrosoft.Office.Interop.Outlook.MailItem Dim adoMsg As MAPI.Message outlookMsg =...
4
6667
by: Pieter | last post by:
Hi, On the pc of one of my clients (W2000, Office 2003) I'm getting sometimes an exception when moving (Move) a MailItem to an Outlook-Folder: The RPC server is not available. (Exception from HRESULT: 0x800706BA). The client has all the updates/service packs/ etc isntalled... Does anybody has any idea why this happens? Any help our hints...
2
2438
by: Pieter | last post by:
Hi, I'm using a thight integration with Outlook 2003 (with an Exchange server) in my VB.NET (2005) application. Until now I'm using the Outlook Object Model, but it appears to be very slow, and has some problems: - doing a Move changes the ReceivedTime of the MailItem - I can't use RichText in the MailItem.Body (only allows plain text or...
3
4039
by: daveward10 | last post by:
I want to be able to drag and drop an Outlook mail message (Outlook 2003) onto a windows form (C# 2003) so that my application can then save the file (in the same was as if I were to drag and drop on the desktop). Anyone able to help me with how to achieve this?
1
1858
by: belinda | last post by:
I have used the ff command but only get the date printout and have no clue whats wrong: 'Printing function ' - opening a Word template with bookmarks ' - read bookmarks list from template and match with the field names in Outlook form ' - value in form is that populated to the Word doc for auto-printing ' - prompt user for closing Word...
4
6435
by: infomage27 | last post by:
I have tried scripting this with rules and VBA, now trying with C# but still failing. (code is exploratory, so please excuse the terribleness) maybe someone here will show me the error of my code... sending an email by hand - everything works as expected (rules, VBA, etc are all applied). sending an email from code (C#, external VBA,...
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7559
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.