![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 139
Rep Power: 4
![]() |
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 SubAny Thoughts ... Many thanks in advance |
|
|
|
|
|
#2 |
|
Professional Programmer
|
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 We all make mistakes. If it doesn't kill us, it will make us stronger. If it does kill us, then it's to late, but it was a great ride while it lasted. - Seth Hall |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
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.. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |