Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mapi on windows 7

Status
Not open for further replies.

griffitd

Programmer
Aug 20, 2002
189
0
0
GB
Hi

I have some code which connect to the current outlook session and then displays the email selection list from out on screen. When ok is selected a text box is populated with the names selected:

Public Function AmmendEmailList(MyArray As XArray) As Boolean
Dim r As Integer
Dim doo As Integer
Dim MyErrNumber As Long
Dim MyErrDescription As String
Dim NewRec As Integer
Dim FullToText As String


doo = 0
AmmendEmailList = True
On Error GoTo err1:
Screen.MousePointer = 11

'sign on to email
MDISpecMain.MAPISession1.LogonUI = True
MDISpecMain.MAPISession1.SignOn

MDISpecMain.MAPIMessages1.SessionID = MDISpecMain.MAPISession1.SessionID

'open temp message
MDISpecMain.MAPIMessages1.MsgIndex = -1

'remove any email receps
For r = MDISpecMain.MAPIMessages1.RecipCount To 0 Step -1
MDISpecMain.MAPIMessages1.RecipIndex = r
MDISpecMain.MAPIMessages1.Delete mapRecipientDelete
Next r

NewRec = 0

'fill Recip list with known names
MDISpecMain.MAPIMessages1.AddressResolveUI = True
For r = 0 To MyArray.UpperBound(1)
MDISpecMain.MAPIMessages1.RecipIndex = NewRec
MDISpecMain.MAPIMessages1.RecipDisplayName = MyArray(r, 0)
MDISpecMain.MAPIMessages1.ResolveName
If doo = 1 Then
If Trim$(MyArray(r, 0)) <> "" Then
MsgBox "Invalid Email Address '" & Trim$(MyArray(r, 0)) & "'", vbCritical + vbOKOnly, "User not found"
End If
MDISpecMain.MAPIMessages1.Delete mapRecipientDelete
doo = 0
Else
NewRec = NewRec + 1
End If
Next r

Screen.MousePointer = 0

'show and edit resolved names
MDISpecMain.MAPIMessages1.Show False

'put Recip list back into MyArray
MyArray.ReDim 0, -1, 0, -1
MyArray.ReDim 0, MDISpecMain.MAPIMessages1.RecipCount - 1, 0, 1
For r = MDISpecMain.MAPIMessages1.RecipCount - 1 To 0 Step -1
MDISpecMain.MAPIMessages1.RecipIndex = r
MyArray(r, 0) = MDISpecMain.MAPIMessages1.RecipDisplayName
MDISpecMain.MAPIMessages1.Delete mapRecipientDelete
Next r

On Error GoTo 0

Exit Function
err1:
MyErrNumber = Err.Number
MyErrDescription = Err.Description

If MyErrNumber = 32050 Then ' All ready logged on
Resume Next
ElseIf MyErrNumber = 32003 Then
MDISpecMain.MAPISession1.LogonUI = True
Resume
ElseIf MyErrNumber = 32001 Then
AmmendEmailList = False
Resume SkipSave:
ElseIf MyErrNumber = 32014 Or MyErrNumber = 32021 Or MyErrNumber = 32011 Then
MsgBox "Can not find Email Address for '" & MyArray(r, 0) & "'", vbExclamation + vbOKOnly, "User not found"
Resume Next
Else
doo = 1
Resume Next
End If
End Function

This line shows the conatcs
MDISpecMain.MAPIMessages1.Show False

no matter how many contacts i select MDISpecMain.MAPIMessages1.RecipCount is always = 0

this only happen on windows 7.

On windows XP its fine.

We are using outlook 2003 and 2007 and is the same for both

Thanks
 
My understanding is that the VB6 MAPI controls use Simple MAPI, and support for Simple MAPI is gradually being reduced in both Windows itself and the Office products over time.

Everything on the topic over at MSDN contains warnings such as:

Deprecated. The use of this technology is discouraged. Related API may be removed from future releases of Windows.
The use of Simple MAPI is discouraged. It may be altered or unavailable in subsequent versions of Windows.

Where OS versions are mentioned as supported Windows Vista is the newest version listed.

I haven't seen any recomendations of alternatives. I'm not sure whether something like Outlook Redemption might help you.
 
Given the goal, I'd guess that converting to using the Outlook library may be viable
 
I cannot comment on the code above however basic MAPI stuff like that I posted in thread222-1196390 is still working for me under W7 64 bit and Outlook 2010 32 bit.
 
Hi

Thanks for the replies.

I have found a Microsoft hotfix that resolves the issue

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top