Answered Changing Outlook email settings with VBE

  • Saturday, March 25, 2006 10:35 AM
     
     

    I would like to change the "Leave a copy of messages on the server " option in Outlook with Visual Basic Express.

    The Visual Basic Express code would change that setting for all or some of the email accounts. Ideally, it should be possible to do it on computers on a network.

     

    Does anyone know how this can be done?

     

    Thanks,

     

    Antonio

All Replies

  • Thursday, April 06, 2006 6:23 PM
     
     Answered

    Per our support engineer:

    I think our buddy wants to automatically set the "Leave a copy of messages on the server” option in Outlook with VBA within all the machines in a certain network in order to keep a copy of email on server side. Base on my experience, I have following comments:

    1)      We can set this option for a POP account to share the email on multiple machines (keeping a server side copy). However, it’s purely a client side behavior. The client may have multiple POP accounts; the size of those mailboxes may vary from one to another. This option can help the end-user to make a balance of taking the risk of mailbox oversize and information sharing/archiving. If there’s a method to force enabling this option all over the network, we may meet some potential problems.

    2)      As to a client side option, the user may disable this option easily after deploying in a network.

    3)      This feature somewhat depends on the server side applications. For example, Exchange by default leaves a copy on server side in mail storage. Personally, I suggest you using Exchange as the mail server and enabling the Exchange user’s accounts instead of POP in OL; especially in a corp network, it’s definitely a recommended way. By chance, we have to deal with SMTP/POP protocol, another option is to leverage SMTP transport event Sink to monitor both inbound and outbound email traffic. Please refer to:

    SMTP Archiver Sink (sample code)

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/smtpevt/html/adce3856-c78b-4e10-9fc3-02a9ba1ee94a.asp

    Why Use SMTP Service Events?

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/smtpevt/html/4f663675-0656-45a9-af6e-a6e77ad24044.asp

    4)      So, you will involve server side technologies for this feature. If you’re using a 3rd party email server, please contact their support resources to confirm if there’re some features like SMTP sink on Exchange.

    -brenda (ISV Buddy Team)

  • Thursday, April 06, 2006 6:54 PM
     
     

    Hi Brenda,

    Thank you for your detailed reply.

    My specific need is simpler than the scenario you describe.

    I have a workgroup in the office with several PCs and laptops. 

    Before I travel or work in a different room for a number of days with a different computer, I copy the Outlook.pst file programatically on the new "working" computer. Then, I tick "leave a copy of messages on the server" for each email account on the other computers and untick it on the computer that I am working with. That way, the computer I am working with has always the full up-to-date Outlook file.

    I have a VBE program that does everything automatically except for the ticking and unticking of the "Leave a copy of messages on the server", that I need to do manually over the different computers for each account, quite a lot of work.

     

    Your help is much appreciated.

     

    Regards,

     

    Antonio

     

     

  • Wednesday, April 12, 2006 6:05 PM
     
     

    Here's the latest from the support engineer:

    Finally I understand the buddy’s scenario. However, it’s not an easy job because some of the related information is undocumented.

    1)      The profile information of Outlook is stored in registry. Please check on your local machine:

    [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\<profilename>\9375CFF0413111d3B88A00104B2A6676\<00000002>]

    "Leave on Server"=dword:000a0001

    If we have enabled this option, OL will add above entry to the profile in registry. During next startup (must close/reopen OL) of OL, this registry item will take efforts and make the option checked on UI. If we uncheck the option, this item will be removed from the profile. <00000002> also depends on the order of email account in current profile, if the SMTP account is the second one in current profile, usually the number is <00000011> or <00000012>

    2)      Although we know this registry will be the key point for your request, however, the whole registry is not so friendly and readable. It’s by design that OL encrypted many fields for security issues, we can not make sure where this registry item located (if we check this option in OL), and we have to search the tree. The worse thing is that if we originally have not checked this option, where shall we add this registry item?

    3)      So, it depends on whether the settings of SMTP accounts on your employees’ machines are just the same or not. We may have chance to do it automatically (even by simply importing/exporting registry), but it highly depends on your local really scenario.

     

    Thanks for your understanding. If anything I can be of assistance, just feel free to let us know.

    -brenda (ISV Buddy Team)

  • Wednesday, April 12, 2006 6:33 PM
     
     

    Hi Brenda,

     

    Thank you again for your insight.

     

    All the PCs have the same email accounts with the same settings.

     

    I have been looking at the registry key and have confirmed that the "Leave on Server" is there when checked in OL.

    I have also confirmed that the order of the different registry entries does not correspond to the order of the mail accounts in OL. I assume that it will be maintained though.

     

    In this case, is it just a matter of adding or removing that key from the registry for all the accounts in each machine?

    Regards,

     

    Antonio