I am trying to get Outlook message information into Access using VBA. I am able to get PR_SENDER_NAME% (&HC1A001E), PR_SUBJECT (&H37001E)PR_BODY (&H1000001E) no problems thanx to both MapiLab code http://www.mapilab.com/articles/vb_outlook_security_4.html and MSDN code http://support.microsoft.com/kb/171638 however the same doesn't work for PR_MESSAGE_DELIVERY_TIME (&HE060040). I always get a blank string. I think it might have something to do with the SYSTIME format that PR_MESSAGE_DELIVERY_TIME is in but I'm at a loss to convert it to something usable. I can am happy to get the result as a string or date value.
this part of the code references the below functions:
If HrGetOneProp(objItem.MAPIOBJECT, &HE060040, ptrSProp) = 0 Then
Dim sprop As SPropValue
CopyMemory sprop, ByVal ptrSProp, 20
tmpSTRDate = LPSTRtoBSTR(sprop.val1)
MAPIFreeBuffer ptrSProp
End If
sprop.val1 returns a value that appears like an integer that I believe to be ANSI-string but when it runs through the LPSTRtoBSTR function it returns no value.
Function:
Private Function LPSTRtoBSTR(ByVal lpsz As Long) As String
Dim cChars As Long
cChars = lstrlenA(lpsz)
LPSTRtoBSTR = String$(cChars, 0)
CopyMemory ByVal StrPtr(LPSTRtoBSTR), ByVal lpsz, cChars
LPSTRtoBSTR = Trim(StrConv(LPSTRtoBSTR, vbUnicode))
End Function
I assume that I will probably require a seperate function to convert this to a time equivalent unicode but I don't know what is required to do this.
Can somebody please help.
I can provide the entire code if required.
Thankyou in advance
this part of the code references the below functions:
If HrGetOneProp(objItem.MAPIOBJECT, &HE060040, ptrSProp) = 0 Then
Dim sprop As SPropValue
CopyMemory sprop, ByVal ptrSProp, 20
tmpSTRDate = LPSTRtoBSTR(sprop.val1)
MAPIFreeBuffer ptrSProp
End If
sprop.val1 returns a value that appears like an integer that I believe to be ANSI-string but when it runs through the LPSTRtoBSTR function it returns no value.
Function:
Private Function LPSTRtoBSTR(ByVal lpsz As Long) As String
Dim cChars As Long
cChars = lstrlenA(lpsz)
LPSTRtoBSTR = String$(cChars, 0)
CopyMemory ByVal StrPtr(LPSTRtoBSTR), ByVal lpsz, cChars
LPSTRtoBSTR = Trim(StrConv(LPSTRtoBSTR, vbUnicode))
End Function
I assume that I will probably require a seperate function to convert this to a time equivalent unicode but I don't know what is required to do this.
Can somebody please help.
I can provide the entire code if required.
Thankyou in advance