+ Reply to Thread
Results 1 to 4 of 4

Thread: System.Net.Mail question

  1. #1
    dgorka is offline VB.NET Forum Enthusiast dgorka probably authored a book by now dgorka probably authored a book by now dgorka probably authored a book by now
    .NET Framework
    .NET 3.5
    Join Date
    Dec 2006
    Age
    25
    Posts
    88
    Reputation
    87

    Default System.Net.Mail question

    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.

  2. #2
    DevX2K is offline VB.NET Forum Newbie DevX2K is on a distinguished programming path ahead
    .NET Framework
    .NET 1.1 (VS 2003)
    Join Date
    Oct 2007
    Posts
    1
    Reputation
    0

    Default You might find the following link helpfull


  3. #3
    dgorka is offline VB.NET Forum Enthusiast dgorka probably authored a book by now dgorka probably authored a book by now dgorka probably authored a book by now
    .NET Framework
    .NET 3.5
    Join Date
    Dec 2006
    Age
    25
    Posts
    88
    Reputation
    87

    Default

    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

  4. #4
    dgorka is offline VB.NET Forum Enthusiast dgorka probably authored a book by now dgorka probably authored a book by now dgorka probably authored a book by now
    .NET Framework
    .NET 3.5
    Join Date
    Dec 2006
    Age
    25
    Posts
    88
    Reputation
    87

    Default

    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?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts