7 replies
by dale.johnson
There is a sample program that should be installed when VB 6 is installed. It should be located at:
"C:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\SAMPLES\VB98\misc\Vbmail"
This is a very simple application and a very good start. If you do not have this sample, please contact me and I will email it to you.
Dale
by eedwards
by rrv
This function which i have written in VB6 opens the current windows NT user's email user login in MS exchange server and fetches the address book.
rrv@hotvoice.com
Raja venkatesh R
Function LoadMailIds() As Boolean
On Error GoTo ErrHndl
DimobjSession As MAPI.Session
Dim objAddrEntries As AddressEntries
Dim objAddressEntry As AddressEntry
Dim objFilter As AddressEntryFilter
Dim strProfileInfo As String
Dim NxtMailItem As Long
Dim strMailBox As String
Dim ProfPath As String
Dim strServer As String
ProfPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
Call GetKeyValue(HKEY_CURRENT_USER, ProfPath, "DefaultProfile", strServer)
ProfPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & strServer & "\13dbb0c8aa05101a9bb000aa002fc45a"
Call GetKeyValue(HKEY_CURRENT_USER, ProfPath, "001e3001", strMailBox)
strProfileInfo = strServer & vbLf & strMailBox
Set objSession = CreateObject("MAPI.Session")
objSession.Logon , , False, False, , True, strProfileInfo
'open Global address book
Set objAddrEntries = objSession.AddressLists("Global Address Book").AddressEntries
'or open personal address book
Set objAddrEntries = objSession.AddressLists("Personal Address Book").AddressEntries
'MailCCLst is a list box in form frmMail
frmMail.MailCCLst.Clear
NxtMailItem = 0
For Each objAddressEntry In objAddrEntries
NxtMailItem = NxtMailItem + 1
Next
ReDim MailAddressArray(NxtMailItem - 1, 1)
Cnt = 0
For Each objAddressEntry In objAddrEntries
frmMail.MailCCLst.AddItem objAddressEntry.Name
MailAddressArray(Cnt, 0) = objAddressEntry.Name
MailAddressArray(Cnt, 1) = objAddressEntry.Address
Cnt = Cnt + 1
Next
objSession.Logoff
Set objAddrEntries = Nothing
Set objSession = Nothing
LoadMailIds = True
Exit Function
ErrHndl:
LoadMailIds = False
End Function
by eedwards
by rrv
This function which i have written in VB6 opens the current windows NT user's email user login in MS exchange server and fetches the address book.
rrv@hotvoice.com
Raja venkatesh R
Function LoadMailIds() As Boolean
On Error GoTo ErrHndl
DimobjSession As MAPI.Session
Dim objAddrEntries As AddressEntries
Dim objAddressEntry As AddressEntry
Dim objFilter As AddressEntryFilter
Dim strProfileInfo As String
Dim NxtMailItem As Long
Dim strMailBox As String
Dim ProfPath As String
Dim strServer As String
ProfPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
Call GetKeyValue(HKEY_CURRENT_USER, ProfPath, "DefaultProfile", strServer)
ProfPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & strServer & "\13dbb0c8aa05101a9bb000aa002fc45a"
Call GetKeyValue(HKEY_CURRENT_USER, ProfPath, "001e3001", strMailBox)
strProfileInfo = strServer & vbLf & strMailBox
Set objSession = CreateObject("MAPI.Session")
objSession.Logon , , False, False, , True, strProfileInfo
'open Global address book
Set objAddrEntries = objSession.AddressLists("Global Address Book").AddressEntries
'or open personal address book
Set objAddrEntries = objSession.AddressLists("Personal Address Book").AddressEntries
'MailCCLst is a list box in form frmMail
frmMail.MailCCLst.Clear
NxtMailItem = 0
For Each objAddressEntry In objAddrEntries
NxtMailItem = NxtMailItem + 1
Next
ReDim MailAddressArray(NxtMailItem - 1, 1)
Cnt = 0
For Each objAddressEntry In objAddrEntries
frmMail.MailCCLst.AddItem objAddressEntry.Name
MailAddressArray(Cnt, 0) = objAddressEntry.Name
MailAddressArray(Cnt, 1) = objAddressEntry.Address
Cnt = Cnt + 1
Next
objSession.Logoff
Set objAddrEntries = Nothing
Set objSession = Nothing
LoadMailIds = True
Exit Function
ErrHndl:
LoadMailIds = False
End Function
by eedwards
Submitted twice. I accepted the first answer.
Thank you
by eedwards
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending