views:

457

answers:

1

I'm working on Outlook 2003 AddIn using VSTO.Is there a way to Get the Mailbox Name OR NTUserName of the user.

+3  A: 

Hi,

To Get the user name logged on via outlook use Application.NameSpace.CurrentUser

To get the Mailbox Name in 2007 use Store.DisplayName Property

(Edit) In Outlook 2003 you can get the parent of the Inbox folder and the name property should be what you want.

Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder= myNameSpace.GetDefaultFolder(olFolderInbox)
Set myParentFolder = myFolder.Parent

Marcus

76mel
*Store* is available only in Outlook 2007.. Is there a way to achieve the same in Outlook 2003
Deepak N
Oops sorry forgot that you are using 2003, In 2003 Current user is there, the OOM does not expose it. You can get it playing with the parent of the Inbox. as above
76mel
The above approach does not work if default mail delivery location is Personal Folder(.pst data file)..
Deepak N
Are yes , I think you will have to go to MAPI using redemption then As I say the 2003 OOM does not expose it.
76mel
+1 answer completed in the comments
Anonymous Type