Page 1 of 1 1
Topic Options
#165089 - 2006-07-26 05:54 PM Outlook 2003 add shared Mailbox.
rmwennink Offline
Lurker

Registered: 2005-12-01
Posts: 1
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

Top
#165090 - 2006-07-26 07:39 PM Re: Outlook 2003 add shared Mailbox.
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
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

Top
#165091 - 2006-07-26 11:36 PM Re: Outlook 2003 add shared Mailbox.
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
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

Top
#180724 - 2007-09-19 06:38 PM Re: Outlook 2003 add shared Mailbox. [Re: Kdyer]
firstornothing Offline
Lurker

Registered: 2007-09-19
Posts: 1
Loc: UK
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

Top
#180828 - 2007-09-25 04:42 PM Re: Outlook 2003 add shared Mailbox. [Re: firstornothing]
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I would recommend starting your own thread.

Kent


Edited by Kdyer (2007-09-25 04:46 PM)
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#186014 - 2008-03-06 03:25 PM Re: Outlook 2003 add shared Mailbox. [Re: Kdyer]
darklord1981 Offline
Just in Town

Registered: 2008-03-06
Posts: 1
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}")

Top
#186017 - 2008-03-06 05:07 PM Re: Outlook 2003 add shared Mailbox. [Re: darklord1981]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
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?

Top
#186018 - 2008-03-06 05:19 PM Re: Outlook 2003 add shared Mailbox. [Re: Witto]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
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]


Edited by Mart (2008-03-06 05:32 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186020 - 2008-03-06 09:21 PM Re: Outlook 2003 add shared Mailbox. [Re: Mart]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
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

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186026 - 2008-03-07 12:14 AM Re: Outlook 2003 add shared Mailbox. [Re: Mart]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Would it be the file that can be downloaded here: http://www.nodevice.com/dll/profman_dll/item14108.html
Top
#194785 - 2009-07-15 09:21 AM Re: Outlook 2003 add shared Mailbox. [Re: rmwennink]
aviv18 Offline
Fresh Scripter

Registered: 2008-02-05
Posts: 9
Loc: israel
hi to everyone...
so what's the script i can use eventually???

can u copy the script here??


Thanks A Lot,

Aviv Hassidim

Top
#194786 - 2009-07-15 09:52 AM Re: Outlook 2003 add shared Mailbox. [Re: aviv18]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
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.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#194787 - 2009-07-15 11:59 AM Re: Outlook 2003 add shared Mailbox. [Re: Kdyer]
aviv18 Offline
Fresh Scripter

Registered: 2008-02-05
Posts: 9
Loc: israel
Did u managed eventually?? can u send me u're script if u succeded??
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.068 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org