Getting MailBox Properties using Outlook Object Model ?

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 ??
 
S

Sue Mosher [MVP-Outlook]

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.
 
W

W Akthar

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??
 
S

Sue Mosher [MVP-Outlook]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top