Geeks With Blogs
Pranav`s TechNiche technical thoughts of a coffee addicted developer

This is the 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.Accounts
Dim acc As Outlook.Account
MessageBox.Show(“No. of accounts: ” & olAccounts.Count.ToString)

If olAccounts.Count > 0 Then

ReDim emails(olAccounts.Count)
For Each acc In olAccounts
MessageBox.Show(“Name: ” & acc.UserName & “Email: ” & acc.SmtpAddress)
Marshal.ReleaseComObject(acc)
Next

Else

MessageBox.Show(“There are no accounts in Outlook”)

End If

Hope this helps!

Posted on Tuesday, May 25, 2010 6:02 PM VSTO | Back to top


Comments on this post: Getting accounts from Outlook 2007 using VB.NET in VSTO

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Pranav | Powered by: GeeksWithBlogs.net