Accessing the "Contacts" field of Outlook items

  • From: "Reno" <dj.no@xxxxxxxxx>
  • To: exchangelist@xxxxxxxxxxxxx
  • Date: Wed, 14 Sep 2005 07:26:21 -0600

Hi,
here is a problem I can figure out. I have to get the value of the
Contacts field that appears in several standard Outlook items such as
appointments or activities. I got the name for that property thanks to a
Outlook views managment panel (SQL tab), but I can't read it in my
server-side application. Here is a sample of the code. The field that
corresponds to the Contacts (Links property in Outlook 2003 object model)
doesn't seem to be initialized because its value is Nothing.
Does anybody knows what is the problem ?

Dim RecordSet As New ADODB.Recordset
Dim Record As New ADODB.Record

Dim SourceQuery As String = "SELECT ""DAV:href"" FROM scope('shallow
traversal of ""http://localhost:81/public/MyFolder"";')"

Dim Conn As New ADODB.Connection
Conn.Provider = "ExOLEDB.DataSource"
Conn.Open(Folder)

Try
RecordSet.Open( _
            SourceQuery, _
            Conn, _
            ADODB.CursorTypeEnum.adOpenDynamic, _
            ADODB.LockTypeEnum.adLockUnspecified, _
            ADODB.CommandTypeEnum.adCmdUnspecified)

         While Not RecordSet.EOF
            Record.Open(RecordSet("DAV:href").Value, Conn,
ADODB.ConnectModeEnum.adModeRead)
           
MsgBox(Record.Fields("http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8586001f";).Value)

            Record.Close()
            RecordSet.MoveNext()
         End While
      Catch ex As Exception
         MsgBox(ex.Message)
      End Try

      If RecordSet.State = ADODB.ObjectStateEnum.adStateOpen Then
         RecordSet.Close()
      End If


Other related posts: