Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Recommend book please. Outlook programming with Visual Basic.

Posted on 2004-08-05
6
Medium Priority
?
184 Views
Last Modified: 2013-11-25
Hi,
Can you recommend your favorite book on how to learn about Outlook programming with Visual Basic - like adding to contact from VB or looking up info in contacts from VB.
Thank you,
Phil
0
Comment
Question by:spoowiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 53

Assisted Solution

by:Ryan Chong
Ryan Chong earned 100 total points
ID: 11732935
Here is an example to add contact on Outlook Contact:

Private Sub Command9_Click()
    Dim iOutlook As Outlook.Application
    Dim contact As Outlook.ContactItem
    Set iOutlook = New Outlook.Application
    'Set iOutlook = CreateObject("outlook.Application")
   
    Set contact = iOutlook.Application.CreateItem(olContactItem)
    With contact
   
        .FirstName = "TEST"
        .LastName = "XX"
        .JobTitle = outlook_query(qualification)
        .CompanyName = "Free Lancer"
        .Categories = " Present & Past Personnel"
       
        .Body = "This Outlook Contact was generated automatically by  PERSONNEL Database Program / Note that in case Business mobile and Home Mobile are different, then Business Mobile located under Car Mobile, and the residence one under Pager."
       
        .HomeAddressStreet = outlook_query(contact_home_address)
        .HomeAddressCountry = outlook_query(contact_home_Country)
        .HomeAddressCity = outlook_query(contact_home_city)
        .HomeAddressPostalCode = outlook_query(contact_home_zip)
        .HomeTelephoneNumber = outlook_query(contact_home_telephone)
        .Home2TelephoneNumber = outlook_query(contact_home_telephone_2)
        .MobileTelephoneNumber = outlook_query(contact_home_mobile)
        .HomeFaxNumber = outlook_query(contact_home_fax)
        '.Email1DisplayName = "Home E-mail"
        .Email1Address = "me@domain1.com"
        'MsgBox .Email1DisplayName
        .OtherAddressStreet = outlook_query(contact_res_address)
        .OtherAddressCountry = outlook_query(contact_res_Country)
        .OtherAddressCity = outlook_query(contact_res_city)
        .OtherAddressPostalCode = outlook_query(contact_res_zip)
        .OtherTelephoneNumber = outlook_query(contact_res_telephone)
        .OtherTelephoneNumber = outlook_query(contact_res_telephone_2)
        .PagerNumber = outlook_query(contact_res_mobile & "(Res. Mobile)")
        .OtherFaxNumber = outlook_query(contact_res_fax & "Res. Fax")
        '.Email2DisplayName = "Residence E-mail"
        .Email2Address = "me@domain2.com"
        'MsgBox .Email2DisplayName
       
        .BusinessAddressStreet = outlook_query(contact_job_address)
        .BusinessAddressCountry = outlook_query(contact_job_Country)
        .BusinessAddressCity = outlook_query(contact_job_city)
        .BusinessAddressPostalCode = outlook_query(contact_job_zip)
        .BusinessTelephoneNumber = outlook_query(contact_job_telephone)
        .Business2TelephoneNumber = outlook_query(contact_job_telephone_2)
        .CarTelephoneNumber = outlook_query(contact_job_mobile & "(Work Mobile)")
        .OtherFaxNumber = outlook_query(contact_job_fax & "Res. Fax")
        .Email3Address = outlook_query(contact_job_e - mail)
       
        .Save
        MsgBox "Done!"
    End With
End Sub

Try customize it
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 11732951
To get contacts, try:

Private Sub cmdGetContact_Click()
    Dim myolApp As Outlook.Application
    Dim mynamespace As Outlook.NameSpace
    Dim myitem As Outlook.ContactItem
    Dim myFolder As Outlook.MAPIFolder
   
    Set myolApp = CreateObject("Outlook.Application")

    Set mynamespace = myolApp.GetNamespace("MAPI")
    Set myFolder = mynamespace.GetDefaultFolder(olFolderContacts)

    Debug.Print "Contacts count = " & myFolder.Items.Count

    For i = 1 To myFolder.Items.Count
        Set myitem = myFolder.Items(i)
        Debug.Print myitem.FullName & ": " & myitem.Email1Address
    Next i

    Set myitem = Nothing
    Set mynamespace = Nothing
    Set myFolder = Nothing
    Set myolApp = Nothing
   
End Sub
0
 

Author Comment

by:spoowiz
ID: 11732970
thanks ryancys. however, i'm looking for a book to learn, not only those examples but more.
p.s. the 2nd code will display items in Contacts but not in sub-folders like "hot contacts" under "contacts".
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 53

Expert Comment

by:Ryan Chong
ID: 11734179
Try like:

...
Set myFolder = mynamespace.GetDefaultFolder(olFolderContacts)
   
    For j = 1 To myFolder.Folders.Count
        Set myFolder = myFolder.Folders(j)
       
        For i = 1 To myFolder.Items.Count
            Set myitem = myFolder.Items(i)
            Debug.Print myFolder.Name & "> " & myitem.FullName & ": " & myitem.Email1Address
        Next i
    Next j
...
0
 
LVL 76

Accepted Solution

by:
David Lee earned 100 total points
ID: 11738321
The book I use is "Building Applications with Microsoft Outlook 2000 Technical Reference", ISBN 0-7356-0581-5.  It's from Microsoft Press.  
0
 

Author Comment

by:spoowiz
ID: 11991939
I'm closing this question out. Thanks both of you.
I decided on "Developing Applications using Outlook 2000, CDO, Exchange, and Visual Basic..." from amazon.
ryan, you didn't recommend a book but learned from your code so awarding points also.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question