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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReportItem Body isn't here and Microsoft Knows this

Status
Not open for further replies.

JPeters

MIS
Jul 25, 2001
423
US
Hey,

I'm using Microsoft Access 97 and Outlook 98. I've got some code that imports the MailItems in the inbox to a table in my Access Database. What I'm trying to do is import a ReportItem (udeliverable reciept reports) into this database so I can flag e-mails that need to be resent to clients.

When I try populating a field with ReportItem.Body the field remains blank (even though this should not be null). Unfortunately Microsoft knew this problem in 97, knew it in 2000, but waited till 2002 to fix it - so it works in Outlook 2002.

I'm stuck with Outlook98. The ReportItem's body HAS to be stored in some outlook item's MAPI area. Does anyone know which one? I think I've tried them all, but I may have missed a few?

-Josh -JPeters
These things take time...
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
 
Here's my code if you want to test it. Table's fields must have Zero Length Value's allowed.

Sub ImportUndeliverableFromOutlook()

' This code is based in Microsoft Access.

' Set up DAO objects (uses existing "tblUndeliverable" table)
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblUndeliverable")


' Set up Outlook objects.
Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim cf As Outlook.MapiFolder
Dim c As Outlook.ReportItem
Dim objItems As Outlook.Items
Dim Prop As Outlook.UserProperty
Dim iNumContacts As Integer
Dim i As Integer

Set olns = ol.GetNamespace("MAPI")
Set cf = olns.GetDefaultFolder(olFolderInbox)
Set objItems = cf.Items
iNumContacts = objItems.Count
If iNumContacts <> 0 Then
For i = 1 To iNumContacts
If TypeName(objItems(i)) = &quot;ReportItem&quot; Then
Set c = objItems(i)
rst.AddNew
'rst!To = c.
'rst!From = c.
rst!Subject = c.Subject
rst!Message = c.Body
rst!Recieved = c.CreationTime
'rst!Sent = c.
' Custom Outlook properties would look like this:
' rst!AccessFieldName = c.UserProperties(&quot;OutlookPropertyName&quot;)
rst.Update
End If
Next i
rst.close
MsgBox &quot;Finished.&quot;
Else
MsgBox &quot;No contacts to export.&quot;
End If


End Sub

Thanks... -JPeters
These things take time...
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top