Discussion Locked

Retrieving the current Mailbox within a

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have an Outlook Item Template, that on opening ask you to select a valid mailbox from the current Global Address List.

What I want is for it not to ask me but to find the current mailbox that is open, i.e for myself the mailbox name would be Fox, David how can I retrieve this value within a VB script.

2 replies

by msheehan

Sub Command_Click()
Set oOutlook = CreateObject("Outlook.Application")
Set oNS = oOutlook.GetNameSpace("MAPI")

From there you can (for example) :

Set oCalendar = oNS.GetDefaultFolder(olFolderCalendar)
Set oItems = oCalendar.Items
Set oFirst = oItems.GetFirst()
oFirst.Display

The key is getnamespace("MAPI") which just uses the current login.

-Mike

This discussion is closed to new replies.