How to access user defined fields through VBA
Hi Rod,
I tested it and it worked out fine, thanks a lot. However it lead me to
another problem: If I want to create an Item which is an instance of my
modified task, I use MAPIfolder.Items.Add("IPM.Task.MyTaskName"), that's
what my office help file told me to do. However, just an ordinary task
is created. I wondered if I have to pass the MessageClass as an Object,
but I don't know how to obtain that object - all I know is the String
representation. Do you have an idea?
Cheers,
Oliver
Rod Plastow schrieb:
Hi Oliver,
I believe you will find your user defined fields/attributes in the
UserProperties collection for each particular item. Use the Find method to
set a reference to a particular UserProperty and then you can interrogate all
the object properties of that UserProperty. Here's a code extract from one
of my modules.
Public Sub InitialiseContact(p_Contact As Outlook.ContactItem)
Dim objProperty As Outlook.UserProperty
Dim objCategory As BEWarden.Category
Dim strCategory As String
Dim i As Integer
m_strFullName = p_Contact.FullName
m_strFileAs = p_Contact.FileAs
Set objProperty = p_Contact.UserProperties.Find("Salutation")
If (objProperty Is Nothing) Then
m_strSalutation = "Dear " & p_Contact.FirstName & "," & bewCrLf2
Else
m_strSalutation = "Dear " & objProperty.Value & "," & bewCrLf2
End If
Set objProperty = p_Contact.UserProperties.Find("Spouse First Name")
If Not (objProperty Is Nothing) Then
m_strSpouseFirstName = objProperty.Value
End If
Set objProperty = p_Contact.UserProperties.Find("Number Of Dependents")
If (objProperty Is Nothing) Then
m_intNumberDependents = 0
Else
m_intNumberDependents = objProperty.Value
End If
Hope this helps. (Incidentally I have long used Access as the engine on a
number of applications linking Access to an ERP via ODBC and then presenting
the analysis via Excel, Word, Project, Outlook etc. magic isn't it?)
Regards,
Rod
"Oliver Gräser" wrote:
Hi there,
I just started to customize Outlook 2000 a little, fascinating what this
program can do. I created a new form, extending an appointment with two
name fields and an additional begin/end time for each of these names.
What I intended to be the fun part was accessing the data in these
fields from Access. We use some VBA macros here to create tasks in a
public folder from data provided from our ERP database. Creating these
tasks works fine as I don't need any additional fields in these task,
and I know how to access all properties of TaskItem. However, I have no
idea how to access the data in the additional fields. I suppose the form
creates a class that inherites all properties of AppointmentItem. But
how is this class named, and its properties? Is it possible to access
those fields through VBA at all? Or does a later version of Exchange /
Outlook (we're using 2000) offer these features? Btw, if anyone knows
any book etc dealing with this, just give me a hint...
Thanks a lot
Oliver
|