ADODB and exchange 2000 calendar question

R

rob merritt

Hi

I am trying to create a web page (VB aspx) that users can http browse
to and get a tally of their appointments and their catagories (these
user track their work load by booking appt ments and classifying them
by appointment catagory)
here is teh code I found and modifided

<%@ Page Language="vb" %>
<%@ import Namespace="system.data" %>
<%@ import Namespace="ADODB" %>
<script runat="server">

' Insert page code here
'

Sub page_load()



Dim oCn As ADODB.Connection
Dim oRs As ADODB.Recordset

oCn = New ADODB.Recordset()
oRs= New ADODB.Connection()

Dim oFields As ADODB.Fields
Dim oField As ADODB.Field

' TODO: Replace with your folder URL
Dim sFdUrl As String
sFdUrl = "http://sps1s/Exchange/merrittr/Inbox"

oCn.Provider = "exoledb.datasource"
oCn.Open(sFdUrl, "", "", -1)

If oCn.State = 1 Then
Console.WriteLine("Good Connection")
Else
Console.WriteLine("Bad Connection")
Return
End If

' TODO: you may want to retrieve more properties
Dim strSql As String
strSql = ""
strSql = "select "
strSql = strSql + "
""urn:schemas:mailheader:content-class"""
strSql = strSql + ", ""DAV:href"" "
strSql = strSql + ",
""urn:schemas:mailheader:content-class"" "
strSql = strSql + ", ""DAV:displayname"""
strSql = strSql + " from scope ('shallow traversal of
" + """"
strSql = strSql + sFdUrl + """') "
strSql = strSql + " WHERE ""DAV:ishidden"" = false"
strSql = strSql + " AND ""DAV:isfolder"" = false"

oRs.Open(strSql, oCn, _
ADODB.CursorTypeEnum.adOpenUnspecified, _
ADODB.LockTypeEnum.adLockOptimistic, 1)

' Example: get the first message
' A loop could also be written to iterate through all
of the
messages!

oRs.MoveFirst()

' get Recordset fields
oFields = oRs.Fields

' List all fields
'Dim i As Integer
'For i = 0 To oFields.Count - 1
' oField = oFields.Item(i)
' Console.WriteLine("{0} : {1}", oField.Name,
oField.Value)
'Next

' Get item URL
Dim sURL As String
oField = oFields.Item("DAV:href")
sURL = oField.Value.ToString()
Console.WriteLine(sURL)

' You can also open the item with Message object
Dim iMsg As CDO.Message = New CDO.Message()
iMsg.DataSource.Open(sURL, oRs.ActiveConnection, _
ADODB.ConnectModeEnum.adModeReadWrite, _
ADODB.RecordCreateOptionsEnum.adFailIfNotExists, _
ADODB.RecordOpenOptionsEnum.adOpenSource, _
"", "")

Console.WriteLine("{0}", iMsg.Sender)
Console.WriteLine("{0}", iMsg.Subject)
Console.WriteLine("{0}", iMsg.TextBody)

' List message fields
oFields = iMsg.Fields
For i = 0 To oFields.Count - 1
oField = oFields.Item(i)
response.write.Write("{0} : {1}", oField.Name,
oField.Value)
Next

oRs.Close()
oCn.Close()

oCn = Nothing
oRs = Nothing
oFields = Nothing
oField = Nothing

'Use the line below to persist the console window for
examination
'Console.ReadLine()

End Sub

</script>
<html>
<head>
</head>
<body>
</body>
</html>

here is the error I get browsing to it.
******

Compiler Error Message: BC30002: Type 'ADODB.Connection' is not
defined.

Source Error:



Line 11:
Line 12:
Line 13: Dim oCn As ADODB.Connection
..
..
..
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

C:\WINNT2K\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\root\49af84b9\5dda2fd8\5cvysbfv.0.vb(14) : error BC30466:
Namespace or type 'ADODB' for the Imports 'ADODB' cannot be found.

Imports ADODB
~~~~~
C:\web\calendar\calendar.aspx(13) : error BC30002: Type
'ADODB.Connection' is not defined.

it suggests I dont have the ADODB lib installed even though I
explicitly did this:
c:\TlbImp.exe "C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll"
Microsoft (R) .NET Framework Type Library to Assembly Converter
1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

TlbImp warning: Primary interop assembly 'ADODB, Version=7.0.3300.0,
Culture=neu
tral, PublicKeyToken=b03f5f7f11d50a3a' is already registered for type
library 'C
:\Program Files\Common Files\SYSTEM\ADO\msado15.dll'.
Type library imported to ADODB.dll

any thoughts on me getting this going?
 
R

rob merritt

I don't think so
the only reference I added for
import "ADODB" was

c:\TlbImp.exe "C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll"

what dll do I need for ado 2.7?
 
B

Brian Parlier

I your Solution Explorer right click References and choose add reference.
Select the COM tab a scroll to select Microsoft ActiveX Data Objects 2.7
Library

On a side note, without knowing what you are doing, I would recommned using
ADO.Net and the DataReader object rather than ADODB. It is designed for
disconnected operations that the web presents us and will offer you a
performance boost.

Hope this helps
Brian Parlier
 
R

rob merritt

still doesnt seem to work here is what i get

C:\WINNT2K\system32>
"c:\winnt2k\microsoft.net\framework\v1.1.4322\vbc.exe" /t:library
/utf8output
/R:"c:\winnt2k\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\syst
em.web.dll"
/R:"c:\winnt2k\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.d
ll"
/R:"c:\winnt2k\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d5
0a3a\system.web.services.dll"
/R:"c:\winnt2k\microsoft.net\framework\v1.1.4322\temporary asp.net
files\calendar\2bd5aae7\b0a16b6b\assembly\dl2\cbf2d357\67c5cd1d_330dc401
\calendar.dll"
/R:"c:\winnt2k\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\syst
em.xml.dll"
/R:"c:\winnt2k\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\
system.drawing.dll"
/R:"c:\winnt2k\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a
3a\system.web.mobile.dll"
/R:"c:\winnt2k\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\sys
tem.data.dll"
/R:"c:\winnt2k\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f
7f11d50a3a\system.enterpriseservices.dll"
/R:"c:\winnt2k\microsoft.net\framework\v1.1.4322\temporary asp.net
files\calendar\2bd5aae7\b0a16b6b\ek_migq2.dll"
/out:"C:\WINNT2K\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\calendar\2bd5aae7\b0a16b6b\uoy3hhyd.dll" /D:DEBUG=1 /debug+
"C:\WINNT2K\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\calendar\2bd5aae7\b0a16b6b\uoy3hhyd.0.vb"


Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

C:\WINNT2K\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\calendar\2bd5aae7\b0a16b6b\uoy3hhyd.0.vb(14) : error BC30466:
Namespace or type 'ADODB' for the Imports 'ADODB' cannot be found.

Imports ADODB
~~~~~
C:\web\calendar\calendar.aspx(13) : error BC30002: Type
'ADODB.Connection' is not defined.

Dim oCn As ADODB.Connection
~~~~~~~~~~~~~~~~
C:\web\calendar\calendar.aspx(14) : error BC30002: Type
'ADODB.Recordset' is not defined.

Dim oRs As ADODB.Recordset
~~~~~~~~~~~~~~~
C:\web\calendar\calendar.aspx(16) : error BC30002: Type
'ADODB.Recordset' is not defined.

oCn = New ADODB.Recordset()
~~~~~~~~~~~~~~~
C:\web\calendar\calendar.aspx(17) : error BC30002: Type
'ADODB.Connection' is not defined.

oRs= New ADODB.Connection()
~~~~~~~~~~~~~~~~
C:\web\calendar\calendar.aspx(19) : error BC30002: Type 'ADODB.Fields'
is not defined.

Dim oFields As ADODB.Fields
~~~~~~~~~~~~
C:\web\calendar\calendar.aspx(20) : error BC30002: Type 'ADODB.Field' is
not defined.

Dim oField As ADODB.Field
~~~~~~~~~~~
C:\web\calendar\calendar.aspx(50) : error BC30451: Name 'ADODB' is not
declared.

ADODB.CursorTypeEnum.adOpenUnspecified, _
~~~~~
C:\web\calendar\calendar.aspx(51) : error BC30451: Name 'ADODB' is not
declared.

ADODB.LockTypeEnum.adLockOptimistic, 1)
~~~~~
C:\web\calendar\calendar.aspx(55) : error BC30451: Name 'messages' is
not declared.

messages!
~~~~~~~~~
C:\web\calendar\calendar.aspx(76) : error BC30002: Type 'CDO.Message' is
not defined.

Dim iMsg As CDO.Message = New CDO.Message()
~~~~~~~~~~~
C:\web\calendar\calendar.aspx(78) : error BC30451: Name 'ADODB' is not
declared.

ADODB.ConnectModeEnum.adModeReadWrite, _
~~~~~
C:\web\calendar\calendar.aspx(79) : error BC30451: Name 'ADODB' is not
declared.

ADODB.RecordCreateOptionsEnum.adFailIfNotExists, _
~~~~~
C:\web\calendar\calendar.aspx(80) : error BC30451: Name 'ADODB' is not
declared.

ADODB.RecordOpenOptionsEnum.adOpenSource, _
~~~~~
C:\web\calendar\calendar.aspx(89) : error BC30451: Name 'i' is not
declared.

For i = 0 To oFields.Count - 1
~
C:\web\calendar\calendar.aspx(90) : error BC30451: Name 'i' is not
declared.

oField = oFields.Item(i)
~
C:\web\calendar\calendar.aspx(91) : error BC30516: Overload resolution
failed because no accessible 'Write' accepts this number of arguments.

response.write.Write("{0} : {1}", oField.Name,
oField.Value)
~~~~~~~~~~~~~~
 

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

Similar Threads

Exchange cdoex problem 2
Retrieve EntryID from CDO 1.21 1
Reminder Not set Appointment 2
querying access tables 4
ADODB to ADO.NET conversion 4
ADODB HELP 7
ADODB Question 8
Comparing recordsets in VB2005 2

Top