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

Query returns zero records

Status
Not open for further replies.

markdmac

MIS
Dec 20, 2003
12,340
0
0
US
I am working on a web page that will display calendar information for Exchange Resource accounts. For whatever reason, it seems I cannot get my record set to contain data.

Can anyone see any mistakes here? I have configured IIS for the directory this is in to use an account with full mailbox rights to the resource account.

Code:
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<body>
<%
Dim RS,sys
Set sys = Server.CreateObject("ADSystemInfo")
domainInfo = sys.DomainDNSName

Dim resource
resource = "lunchroom"

Response.Write "<p><b><font size='7' color='#008000'>"
Response.Write UCase(Left(resource,1))
Response.Write Mid(resource,2,Len(resource)-5)
Response.Write " Room Meetings</font></b></p>"

now1 = convertUTC(now(), 18, 0)
now2 = convertUTC(date & " " & timevalue("23:59:59"), 18, 0)
tyear = year(now1)
etyear = year(now2)
tmonth = month(now1)
etmonth = month(now2)
if tmonth < 10 then
	tmonth = 0 & tmonth
end if
if etmonth < 10 then
	etmonth = 0 & etmonth
end if
stday = day(now1)
etday = day(now2)
if stday < 10 then
	stday = 0 & stday
end if
if etday < 10 then
	etday = 0 & etday
end if
sttime = formatdatetime(now1,4)
ettime = formatdatetime(now2,4)
qdatest = tyear & "-" & tmonth & "-" & stday & "T"
qdateed = etyear & "-" & etmonth & "-" & etday & "T"
qdatest1 = qdatest & sttime & ":" & "00Z"
qdatesed = qdateed & ettime & ":" & "00Z"

Set Rs = Server.CreateObject("ADODB.Recordset") 
set Rec = Server.CreateObject("ADODB.Record")
Set Conn = Server.CreateObject("ADODB.Connection")
CalendarURL = "file://./backofficestorage/" & domainInfo & "/MBX/" & resource & "/calendar/"
Conn.Provider = "ExOLEDB.DataSource"
Rec.Open CalendarURL
Set Rs.ActiveConnection = Rec.ActiveConnection
Rs.Source = "SELECT ""DAV:href"", " & _
                  " ""urn:schemas:httpmail:subject"", " & _
                  " ""urn:schemas:calendar:dtstart"", " & _
                  " ""urn:schemas:calendar:dtend"", " & _
		  " ""urn:schemas:calendar:organizer"", " & _
		  " ""DAV:contentclass"" " & _
            	  "FROM scope('shallow traversal of """ & CalendarURL & """') " & _
		 "WHERE (""urn:schemas:calendar:dtend"" >= CAST(""" & qdatest1 & """ as 'dateTime')) " & _
                 "AND (""urn:schemas:calendar:dtend"" <= CAST(""" & qdatesed & """ as 'dateTime'))" & _
		 " AND ""DAV:contentclass"" = 'urn:content-classes:appointment'" & _
		 "ORDER BY ""urn:schemas:calendar:dtstart"" ASC"
Rs.Open
Response.Write CalendarURL
Response.Write "<br>Number of appointments:" & RS.RecordCount
      


RS.close
%>

</table>
<p>&nbsp;</p>The page will automatically refresh every 30 Seconds Last updated on <%Response.write(Now) %>

<%
function convertUTC(dtconv, tzfr, tzTo)
	Set tapptobj = CreateObject("CDO.Appointment")
	Set tapptconf = CreateObject("CDO.Configuration")
	tapptobj.Configuration = tapptconf
	tapptconf.Fields("urn:schemas:calendar:timezoneid").Value = tzfr
	tapptconf.Fields.Update
	tapptobj.StartTime = dtconv
	tapptconf.Fields("urn:schemas:calendar:timezoneid").Value = tzTo
	tapptconf.Fields.Update
	convertutc = tapptobj.StartTime
end function
%>


</body>
</html>

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top