Auto load word documents to Business History folder in Outlook BCM

C

Casey

I am helping a friend update his contact information from an Access
application into Business Contact Manager. The existing app has a comments
column which is defined as memo and some of his entry have a size that
exceeds the limits of the comment field in outlook. The dicision was to
create word documents from these comments (this task I have completed) and
then add them to the Business History folder in BCM. I am having problems
with this part of the task.

Here is what I have that is not working.

Function foo2()

Dim objNS As NameSpace
Dim objFR(0 To 1) As Object
Dim objCN As ContactItem
Dim objJN As JournalItem
Dim objOB As Object
Dim objLNS As Links
Dim objLN As Link

Dim liX As Integer

Set objNS = Outlook.Application.GetNamespace("MAPI")
Set objFR(0) = objNS.Folders(2).Folders(1)
Set objFR(1) = objNS.Folders(2).Folders(4)

For liX = 1 To objFR(0).Items.Count

If objFR(0).Items(liX).Class = olContact Then

Set objCN = objFR(0).Items(liX)
Set objJN = objFR(1).Items.Add(olJournalItem)
Set objLNS = objJN.Links
Set objOB = objCN
objJN.Body = "File: " & objCN.FirstName & " " & objCN.LastName &
".doc"

Set objLN = objLNS.Add(objCN)
objJN.Attachments.Add "C:\Documents and Settings\Clever\My
Documents\Access Files\" & _
objCN.LastName & ", " & objCN.FirstName &
".doc", olByReference
'objJN.Save
'objJN.Close olSave

End If

Next

Set objNS = Nothing
Set objCN = Nothing
Set objJN = Nothing
Set objFR(0) = Nothing
Set objFR(1) = Nothing

End Function

Note:

These do not work in BCM

'objJN.Save
'objJN.Close olSave

thanks in advance
Casey
 
E

Eric Legault [MVP - Outlook]

What comment field are you referring to that isn't large enough to store your
memo field data? You can use the ContactItem.Body property to store it.

Try adding an error handler to your routine to see why your new Journal item
isn't saving. Also try stepping through the code line by line to see what
might be breaking or acting up unexpectedly.
 
S

Sue Mosher [MVP-Outlook]

Because BCM data is actually stored in a database, there is a definite limit
to the amount of information that the Body information can hold. None of the
BCM folders, including Business History, support items with attachments.

Also, BCM uses its own linking mechanism based on the underlying relational
database structure (undocumented) and does not use the Links collection as
Outlook does. So even if the method could accomodate attachments, it
wouldn't result in related items.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
C

Casey

Sue,

Thank you for your thoughts. You obviously have an understanding of this
product. So if I may, can I ask you a few questions?

1) Do you think storing this information as a word document in the History
Folder is a good solution? Or might you have another suggestion?

2) If this is the approach, would you know if there is a way to emulate the
manual process using VBA? This person has an existing database of over 1000
contacts and I thought I could save him the effort of doing this manually. If
this data is in a database, can this be done using ADO?

I am fairly comfortable with VBA, but most of my experience is with Access
and Excel. The code examples for I've been getting for Outlook/BCM off of the
net.

Thanks again

Casey
 
S

Sue Mosher [MVP-Outlook]

1) Do you think storing this information as a word document in the History
Folder is a good solution? Or might you have another suggestion?

It's not even possible. You cannnot store attachments in any BCM folder. You
could, however, store an attachment in a system folder and include a text
link in the BCM item.
2) If this is the approach, would you know if there is a way to emulate
the
manual process using VBA? This person has an existing database of over
1000
contacts and I thought I could save him the effort of doing this manually.
If
this data is in a database, can this be done using ADO?

Yes, it would in theory be possible to automated this, putting text links in
the existing BCM items to point to your Word documents. It could be done
with ADO, but would be much easier with Outlook objects, since the structure
of the BCM database isn't.
 
C

Casey

Thanks again Sue!

I will consider putting a hyperlink to the document in the contact body.

I was looking to automate something that we had already done manually and
that was to attach the document to the contact in the 'Business History'
area. The product seems to allow you to attach (I use this term loosly) a
number of Outlook object types to a contact in this place by use of the Add
button.

Casey
 

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