Getting accounts from Outlook 2007 using VB.NET in VSTO
Posted
by Pranav
on Geeks with Blogs
See other posts from Geeks with Blogs
or by Pranav
Published on Tue, 25 May 2010 12:02:53 GMT
Indexed on
2010/05/25
12:41 UTC
Read the original article
Hit count: 276
This is a sample code for getting Email accounts which are configured in Outlook 2007. This is developed using native code of VSTO. We can also implement is using 3rd party libraries like Redemption.
Dim olAccounts As Outlook.Accounts = Globals.ThisAddIn.Application.ActiveExplorer().Session.AccountsDim acc As Outlook.AccountMessageBox.Show(“No. of accounts: ” & olAccounts.Count.ToString)If olAccounts.Count > 0 ThenReDim emails(olAccounts.Count)For Each acc In olAccountsMessageBox.Show(“Name: ” & acc.UserName & “Email: ” & acc.SmtpAddress)Marshal.ReleaseComObject(acc)NextElseMessageBox.Show(“There are no accounts in Outlook”)End IfHope this helps!
© Geeks with Blogs or respective owner