This documentation is archived and is not being maintained.

Using ADO to Set the SCR and Default Document Properties

Exchange Server 2003

Using ADO to Set the SCR and Default Document Properties

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Web items can be registered in the store as the default page for a particular folder. You can do this by setting the DAV:defaultdocument to the name of the item.

When the user opens the folder, the default page appears instead of the usual list of files. (The default page is set to the default document properties.)

This example uses an ASP Web page to create a ActiveX Data Objects database (ADODB) object. It updates the SCR and the default document properties.

Before you run the code, make sure that you log on as a user authorized to write to the store.

Note  To return to the original default folder, set the default document property to "".
Note  Registering the form will override the default document setting.

VBScript

Note  The following example uses a file URL with the Exchange OLE DB (ExOLEDB) provider. The ExOLEDB provider also supports The HTTP: URL Scheme. Using The HTTP: URL Scheme allows both client and server applications to use a single URL scheme.
<HTML>
<HEAD>
<%@ LANGUAGE = "VBScript" %>
<%
Const adModeReadWrite       = 3
Const adFailIfNotExists     = -1
Const adCreateNonCollection = 0

Dim strURL
strURL = "file://./backofficestorage/ServerName.microsoft.com/public folders/myappfolder3/"

Dim Rec
Set Rec = CreateObject("ADODB.Record")

response.write strURL

Rec.Open strURL,,adModeReadWrite, adFailIfNotExists
response.write "<P>"

Dim Flds
Set Flds = Rec.Fields

' Set the SCR and the default document
Flds("urn:schemas-microsoft-com:exch-data:schema-collection-ref") = strURL & "schema5h/"
Flds("DAV:defaultdocument") = "default2.htm"
Flds.Update

Response.write(Err.number) & "<P>"
response.write"<H3>SUCCESS</H3>"

Rec.Close
%>

</HEAD>
<BODY>
</BODY>
</HTML>
Show: