Outlook 2002 Plugin with Extended Mapi API

M

mike

I'm trying to use some of the MAPI32.DLL functions from within a
Outlook plugin written in VB6. Specifically, I'm running into a
problem with calling the hrGetOneProp call. Can anyone tell me if this
is just impossible or am I doing something wrong?

I believe the problem is in trying to pass the .MAPIOBJECT property of
an OOM object such as an ol ContactItem. Both the MAPIInitialize and
the MAPIUnitialize functions seem to work fine but I get the dreaded
"Bad DLL calling convention error" on the hrGetOneProp call. Here is
the relevant code snippet... The website MapiLab.com has an example
very similar to this on the web site which I can't get to work
either...Has anyone had success with using the mapi32 api from within
VB?

I've had success in getting the needed information using both Dmitry's
excellent Redemption library and also the MapiLab's mapiProps library.
This particular project, however is part of an open source project and
I need to stay away from any third party / commercial libraries...

Appreciate any help or nods in the right direction!
Mike

<Code snippet-------------------------------------------------------->

Private Declare Function HrGetOneProp Lib "mapi32" _
Alias "HrGetOneProp@12" ( _
ByVal lpMapiProp As IUnknown, _
ByVal ulPropTag As Long, _
ByRef lppProp As Long) As Long

Private Declare Function MAPIInitialize Lib "mapi32" ( _
ByVal lpMAPIInit As Long) As Long

Private Declare Sub MAPIUninitialize Lib "mapi32" ()

Public Function GetOneProp(olObject As Object, lngPropTag As Long) As
String
Dim ptrSProp As Long
Dim lResult as long

ptrSProp = 0

If MAPIInitialize(0) = 0 Then
lResult = HrGetOneProp (olObject.MAPIOBJECT, lngPropTag,
ptrSProp)
'
' Do some stuff here...
'
MAPIFreeBuffer ptrSProp
MAPIUninitialize
End If

End Function
 
K

Ken Slovak

Extended MAPI is not usable from VB unless you use an intermediary such as
Redemption or the MAPILabs utility.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top