Getting MailBox Properties using Outlook Object Model ?

  • Thread starter Thread starter W Akthar
  • Start date Start date
W

W Akthar

Hi,

How can get access the mailbox properties using the
outlook object model?
I need to record to SQL Server when appointments are made
and emails are sent to certain people using a dotnet
addin I have created but need to get hold of the users
profile, so I can store this information in SQL Server
against this user.

Any ideas ??
 
No, the Outlook object model contains no information on user mail profiles.
It might help if you explained just what information you're trying to store.
 
I need to get hold of the outlook user name.

Outlook.Application olApp;
Outlook._NameSpace olNS = null;

olApp = (Outlook.Application)applicationObject;
olNS = olApp.GetNamespace("MAPI");
if (olNS != null)
{
string currentUser = olNS.CurrentUser.Name;
}

Is this correct??
 
Yes, but (a) that will trigger security prompts in many Outlook application
environments and (b) you may get unexpected results if the user has multiple
accounts or only POP/IMAP accounts. If you want the name on the Exchange
mailbox, walk up the folders hierarchy from the Inbox using the
Namespace.GetDefaultFolder method then the MAPIFolder.Parent object
property.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top