|
|
One function of an app that I created is to send an email to some of our sales people at work, and have a billing report attached. I think that there are only two people that will be receiving this, but with the way things go here, about ten minutes after i deploy it they will want more added to the list.
So what I'm wondering is if there is anyway to hit the exchange server and get a list of peoples emails that I could populate into a listbox on form load, that way they can select however many people they want. This might not be part of System.Net.Mail either...
I looked here and didn't see anything about it and googled it and didn't really find anything. So, any ideas?
Last edited by dgorka; 10-29-2007 at 3:23 PM.
Well, that looks close to what I need, but after doing some research on MSDN I found the directions for coding into Outlook with VSTO. Basically, I found code here that will loop through all the contacts in your default contact folder and output them to a message box (it'll be nothing to populate it to a listbox or some other control instead). The problem I'm having now is that my default contacts folder is returning absolutely nothing. So it won't output anything. Anyone familiar with VSTO that has any ideas about what i might be doing wrong?
Here is the code that I'm using
Code:Sub GetOutlookContacts() Dim ol As Object Dim olns As Object Dim objFolder As Object Dim objAllContacts As Object Dim Contact As Object ' Set the application object ol = New Microsoft.Office.Interop.Outlook.Application ' Set the namespace object olns = ol.GetNamespace("MAPI") ' Set the default Contacts folder objFolder = olns.GetDefaultFolder(OlDefaultFolders.olFolderContacts) ' Set objAllContacts = the collection of all contacts objAllContacts = objFolder.Items ' Loop through each contact For Each Contact In objAllContacts ' Display the Fullname field for the contact MsgBox(Contact.FullName) Next End Sub
Okay, one more update. Turns out its returning nothing for my default folder because it actually is empty. The way our network is here all the contacts are stored in a Global Contact List that everyone accesses. So, now I ask, anyone know how i can get into that through the object model?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks