Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 22nd, 2007, 9:55 AM   #1
paulchwd
Hobbyist Programmer
 
paulchwd's Avatar
 
Join Date: Mar 2005
Posts: 139
Rep Power: 4 paulchwd is on a distinguished road
Question Getting Alias from Address Book ???

Hello All,

I have a small app that sends an email to a person and then looks up their manager in Address Book and sends them an email..unfortunetly there are duplicate names in address book and emails are the same, thus I need to use Alias (or so i've been told)...i cant seem to access the alias field though..

My Code:

 Private Sub doEmail(ByVal Qrecords() As String, ByVal Nrecords() As String, ByVal recordSize As Integer)

        Dim i As Integer 'loop counter
        Dim OutlookApp As New Microsoft.Office.Interop.Outlook.Application 'application
        Dim msg As Microsoft.Office.Interop.Outlook._MailItem 'Mail item  

        Dim attached As Microsoft.Office.Interop.Outlook.Attachments '= msg.Attachments
        Dim attached2 As Microsoft.Office.Interop.Outlook.Attachment

        Dim oNameSpace As Microsoft.Office.Interop.Outlook.NameSpace
        oNameSpace = OutlookApp.GetNamespace("MAPI")

        Dim oAddressLists As Microsoft.Office.Interop.Outlook.AddressLists
        Dim oAddressList As Microsoft.Office.Interop.Outlook.AddressList
        oAddressLists = oNameSpace.AddressLists
        oAddressList = oAddressLists.Item("All Users")

        For i = 0 To UBound(Nrecords)
            msg = OutlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
            attached = msg.Attachments
            msg.To = Nrecords(i)

            If managers.Checked Then
                If Not oAddressList.AddressEntries.Item(Nrecords(i)).Manager Is Nothing Then
                    msg.CC = oAddressList.AddressEntries.Item(Nrecords(i)).Manager.ID

                End If
            End If


            msg.Subject = "Pls review within within 30 days"

            msg.Body = "Your ID: " & Qrecords(i) & " currently has access to." & systemName.Text & Environment.NewLine & Environment.NewLine & " If you still require this access, please respond to " & replyToTxt.Text & " by: " & replyDate.Text & " with the document attached." & vbCrLf & " Please note, if we do not receive a reply by " & replyDate.Text & ", access will be disabled." & vbCrLf & vbCrLf & " Thank you " & vbCrLf & " Please not this is an automated message, please do not reply to sender."
            If Len(attachedFile) > 0 Then
                attached2 = attached.Add(attachedFile)
            End If

            msg.Send()

        Next
    End Sub

Any Thoughts ... Many thanks in advance
paulchwd is offline   Reply With Quote
Old Jun 23rd, 2007, 4:38 AM   #2
bigguy
Professional Programmer
 
bigguy's Avatar
 
Join Date: Sep 2005
Location: Arkansas
Posts: 298
Rep Power: 0 bigguy is an unknown quantity at this point
Send a message via AIM to bigguy Send a message via MSN to bigguy Send a message via Yahoo to bigguy
How can emails be the same?
There cant be two same emails addresses. Like one might be person_123@yahoo.com, but there cant be another person_123@yahoo.com, you see what I'm saying. It could be person_123@gmail.com. Not sure what you mean by same email addresses.

And for the duplicate names in address book.Why not add their last names or something. Like James Henry or J. Henry or James H. Something like that?
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain

Destruction leads to a very rough road, but it also breeds creation.
bigguy is offline   Reply With Quote
Old Jun 23rd, 2007, 1:34 PM   #3
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
Choosing to ignore bigguys post, I recommend you search the Global Address List for alias's because the Alias property is not held within a contacts details but in its properties so you wont find it in the Address Book.
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles..
john Wesley is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SquirrelMail Address book to mySQL Lich PHP 0 Jun 30th, 2006 1:19 PM
OnlineTextEditor.Com! Sane Show Off Your Open Source Projects 43 Jun 16th, 2006 8:55 AM
Pointers in C (Part II) Stack Overflow C 2 Apr 29th, 2005 10:39 AM
Pointers in C (Part I) Stack Overflow C 4 Apr 28th, 2005 7:03 PM
C++ Address Book [NEED HELP] prognewb C++ 5 Mar 16th, 2005 3:25 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:11 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC