rmwennink
(Lurker)
2006-07-26 05:54 PM
Outlook 2003 add shared Mailbox.

Hello,
If got a question. I want to start Outlook 2003 with a user mailbox on exchange. But also with a shared maibox. This isn't something you can configure with an outlook prf file says microsoft. But there is away this can be done (by mapi). Microsoft techned "How to add more Exchange mailboxes to a MAPI profile" Artical id 171636. Only de code is in visual basic. Maybe you guys got an idee how to do this in kix? Thanx


NTDOCAdministrator
(KiX Master)
2006-07-26 07:39 PM
Re: Outlook 2003 add shared Mailbox.

Hello and Welcome to the board.

Well just a quick glance of the code shows that the example is C or C++ code and using NULLS etc...
This can not be converted into KiXtart code.

How to add more Exchange mailboxes to a MAPI profile


Kdyer
(KiX Supporter)
2006-07-26 11:36 PM
Re: Outlook 2003 add shared Mailbox.

Here is one that I did..
Code:

Break on CLS
$hklms = 'HKEY_LOCAL_MACHINE\Software'
$exe=ReadValue($hklms+"\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE","")
Shell($exe) ; -- Start OutlooOK
Sleep 5
;SetFocus("Inbox – Microsoft Outlook")
$=SendKeys("~t")
$=SendKeys("v")
$=SendKeys("~r")
SetFocus("Microsoft Exchange Server")
$=SendKeys("+{TAB}{RIGHT}")
$=SendKeys("~d")
SetFocus( "Add Mailbox" )
$=SendKeys("YouInboxYouWant{ENTER}")
$=SendKeys("{ENTER 2}")



Hope this helps.

Kent


firstornothing
(Lurker)
2007-09-19 06:38 PM
Re: Outlook 2003 add shared Mailbox.

Hi,

Sorry to open up an old topic but I'm having the same problem.
I've tried the code posted by Kdyer/Kent but I'm new at the kixtart scripting and not familiar with the sendkeys and how it works.

The outlook window just stay up and nothing happens interms of the mailbox being added.

Is there another way to tackle this? Via launching an outlook automation and adding mailbox through that way?

I also can't determine which ones are the additional mailboxes as I'm reading the "001e660b" key and then finding the last cn entry as mailbox name.

For my default mailbox its coming up with 3 entries. If the mailbox name and usernames are the same I filter by a trim and an if statement and am alright but ocassionally we get users who'd changed from their maiden name but mailbox name hadn't changed and we get problems.

Hope someone have faced similar situation and have a fix.

Cheers

Min


Kdyer
(KiX Supporter)
2007-09-25 04:42 PM
Re: Outlook 2003 add shared Mailbox.

I would recommend starting your own thread.

Kent


darklord1981
(Just in Town)
2008-03-06 03:25 PM
Re: Outlook 2003 add shared Mailbox.

This is what i did to add Mailboxes to Outlook 2003, I have used Kdyers code on this one as it all works, however I found that the "Send Keys" were not the right ones for 2003. So I have amended them. This one worked for me (it adds 2 Mailboxes, but you can expand that exponentaily). Thank you Kdyer for your code, hope you don't mind the edit!

E.D.

Break on CLS

$hklms = 'HKEY_LOCAL_MACHINE\Software'
$exe=ReadValue($hklms+"\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE","")
Shell($exe) ; -- Start OutlooOK
Sleep 5
$=SendKeys("~t")
$=SendKeys("a")
$=SendKeys ("~V")
$=SendKeys ("n")
$=SendKeys("~c")
$=SendKeys("~M")
$=SendKeys("+{TAB}{RIGHT}")
$=SendKeys("~d")
$=SendKeys("enterthemailboxnamehere{ENTER}")
$=SendKeys("~d")
$=SendKeys("enterthemailboxnamehere{ENTER}")
$=SendKeys("~a")
$=SendKeys("{ENTER}")
$=SendKeys("n")
$=SendKeys("{ENTER}")


Witto
(MM club member)
2008-03-06 05:07 PM
Re: Outlook 2003 add shared Mailbox.

Sendkeys
Isn't that tricky? If someone has a windows in a different language, I bet it doesn't work anymore.
Can't this be done with some COM object?


Mart
(KiX Supporter)
2008-03-06 05:19 PM
Re: Outlook 2003 add shared Mailbox.

That would be great but I've been searching for some time now for a method to get this automated and did not find anything yet. Seems Outlook does not support this (yet).

[edit]
I just send a mail to MS's Scripting guy about htis.
Wait and see what comes back.
[/edit]


Mart
(KiX Supporter)
2008-03-06 09:21 PM
Re: Outlook 2003 add shared Mailbox.

This might be promising.

http://www.dimastr.com/redemption/profiles.htm

 Quote:

....
Normally MAPI profiles can only be manipulated using Extended MAPI in C/C++/Delphi. Profman library allows to manipulate MAPI profiles from any language, including VB and VB script.
....


This is the code from example 6. Looks like VBS but I'm not sure because I'm almost blind in the VB(S) world.
 Code:
add an extra Exchange mailbox to a given profile. This sample uses CDO to retrieve the properties of the mailbox to be added
'see Q171636 for details

'todo: replace the name of the profile!!!
strProfileName = "Dmitry Streblechenko"

PR_STORE_PROVIDERS = &H3D000102
PR_PROVIDER_UID = &H300C0102
PR_DISPLAY_NAME = &H3001001E
PR_PROFILE_MAILBOX = &H660B001E
PR_PROFILE_SERVER = &H660C001E
PR_PROFILE_SERVER_DN = &H6614001E
PR_EMAIL_ADDRESS = &H3003001E

Sub AddMailBox(strProfile, strDisplayName, strMailboxDN, strServer, strServerDN)
  set Profiles=CreateObject("ProfMan.Profiles")
  if strProfile = "" Then
    set Profile = Profiles.DefaultProfile
  Else
    set Profile = Profiles.Item(strProfile)
   End If
  'find the Exchange service
  set Services = Profile.Services
  for i = 1 to Services.Count
    set Service = Services.Item(i)
    if Service.ServiceName = "MSEMS" Then
      'Add "EMSDelegate" provider
      set Properties = CreateObject("ProfMan.PropertyBag")
      Properties.Add PR_DISPLAY_NAME, strDisplayName
      Properties.Add PR_PROFILE_MAILBOX, strMailboxDN
      Properties.Add PR_PROFILE_SERVER, strServer
      Properties.Add PR_PROFILE_SERVER_DN, strServerDN
      set Provider = Service.Providers.Add("EMSDelegate", Properties)
      'update the old value of PR_STORE_PROVIDERS so that Outlook
      'will show the mailbox in the list in Tools | Services
      set GlobalProfSect = Profile.GlobalProfSect
      OldProviders = GlobalProfSect.Item(PR_STORE_PROVIDERS)
      strUID = Provider.UID
      GlobalProfSect.Item(PR_STORE_PROVIDERS) = OldProviders & strUID
    End If
  Next
End Sub

'get PR_PROFILE_SERVER and PR_PROFILE_SERVER_DN 
'It is assumed that the mailbox to add is on the same server as the current user's mailbox 
MAPI_STORE_PROVIDER = 33
set Profiles=CreateObject("ProfMan.Profiles")
set Profile = Profiles.Item(strProfileName)
set Services = Profile.Services
for i = 1 to Services.Count
  set Service = Services.Item(i)
  if Service.ServiceName = "MSEMS" Then
    set Providers = Service.Providers
    for j = 1 to Providers.Count
      set Provider = Providers.Item(j)
      if Provider.ResourceType = MAPI_STORE_PROVIDER Then
        set ProfSect = Provider.ProfSect
        strProfileServer = ProfSect.Item(PR_PROFILE_SERVER)
        strProfileServerDN = ProfSect.Item(PR_PROFILE_SERVER_DN)
      End If
    Next
  End If
Next

'Add the first GAL entry's mailbox to the default profile
set AddrEntry = CDOSession.AddressLists.Item("Global Address List").AddressEntries.Item(1)
AddMailBox strProfileName, _
                    "Mailbox - " & AddrEntry.Fields(PR_DISPLAY_NAME).Value, _
                    AddrEntry.Fields(PR_EMAIL_ADDRESS).Value, _
                    strProfileServer, _
                    strProfileServerDN



Witto
(MM club member)
2008-03-07 12:14 AM
Re: Outlook 2003 add shared Mailbox.

Would it be the file that can be downloaded here: http://www.nodevice.com/dll/profman_dll/item14108.html

aviv18
(Fresh Scripter)
2009-07-15 09:21 AM
Re: Outlook 2003 add shared Mailbox.

hi to everyone...
so what's the script i can use eventually???

can u copy the script here??


Thanks A Lot,

Aviv Hassidim


Mart
(KiX Supporter)
2009-07-15 09:52 AM
Re: Outlook 2003 add shared Mailbox.

It's not that easy.

MS always said that this is not scriptable with an out of the box setup. Could be different with Office/Outlook 2007 but I don’t think so.

The extra DLL Witto linked to and the script I posted might get you there but I never bothered to try to translate and test it.


aviv18
(Fresh Scripter)
2009-07-15 11:59 AM
Re: Outlook 2003 add shared Mailbox.

Did u managed eventually?? can u send me u're script if u succeded??