How To Open Documents Using the Internet Publishing Provider

This article was previously published under Q245359
This article has been archived. It is offered "as is" and will no longer be updated.
The Microsoft Internet Publishing Provider, MSDAIPP.dso, can be used to retrieve documents located in Internet Information Server (IIS) Virtual Directories. The provider can return a Recordset containing all the files in the directory, or a Record object that refers to a single file. You can use the ADO Stream object to read and write to the file if you have appropriate permissions on the server.

This article demonstrates how to successfully make a connection using the MSDAIPP.dso provider and retrieve objects.
MDAC 2.5 allows the MSDAIPP.dso provider to be invoked both explicitly and implicitly. If you invoke it explicitly, you must provide both the Provider and Data Source arguments when connecting. To invoke it implicitly, the connect string must begin with URL=. Using URL= is known as Direct Binding or specifying a Root Binder.

Most examples are shown using indirect binding, though you can also use the explicit syntax in any of the scenarios.

To locate a document, you must specify a URL (the Data Source is also a URL) and a relative path off the URL. The former is known as an Absolute URL; the latter a relative URL. A combination of the two forms a Complete URL.

The following examples illustrate various ways of opening Connection, Recordset, Record, and Stream objects. For purposes of the examples, the complete URL to the document is http://server/docs/mydocs/myfile.txt.

Connection object

You use an absolute URL for the connection.
connection.Open "URL=http://server"
connection.Open "URL=http://server/docs"
connection.Open "URL=http://server/docs/mydocs"
connection.Open "Provider=MSDAIPP.DSO;Data Source=http://server"
connection.Open "Provider=MSDAIPP.DSO;Data Source=http://server/docs"
connection.Open "Provider=MSDAIPP.DSO;Data Source=http://server/docs/mydocs"
connection.Provider = "MSDAIPP.DSO"  ' Data Source is implicit when theconnection.Open = "http://server"    ' Provider is specified separately				
connection.Provider = "MSDAIPP.DSO"connection.Open = "http://server/docs"				
connection.Provider = "MSDAIPP.DSO"connection.Open = "http://server/docs/mydocs"				

Recordset Object

The MSDAIPP.dso provider only returns a Read-only, Forward-only cursor.
  • Opening a Recordset on a directory:
    To retrieve a list of documents in a path, open the Recordset on a connection without specifying a relative URL to a document. You must have permissions in IIS to browse the directory or the provider returns an empty Recordset.

    Root directory:
    rs.Open "", "URL=http://server", , , adCmdTableDirect

    docs directory:
    rs.Open "", "URL=http://server/docs", , , adCmdTableDirect
    rs.Open "docs", "URL=http://server", , , adCmdTableDirect

    mydocs directory:
    rs.Open "", "URL=http://server/docs/mydocs", , , adCmdTableDirect
    rs.Open "mydocs", "URL=http://server/docs", , , adCmdTableDirect
    rs.Open "docs/mydocs", "URL=http://server", , , adCmdTableDirect
  • Opening a Recordset on a file:
    To retrieve a specific document, open the Recordset and specify a relative URL to the document.
    rs.Open "myfile.txt", "URL=http://server/docs/mydocs", , , adCmdTableDirect
    rs.Open "mydocs/myfile.txt", "URL=http://server/docs", , , adCmdTableDirect
    rs.Open "docs/mydocs/myfile.txt", "URL=http://server", , , adCmdTableDirect
  • Opening a Recordset based on a Record object:
    You can use the GetChildren method of a Record object opened on a directory to populate a Recordset of file names.
    rec.Open "docs/mydocs", "URL=http://server"Set rs = rec.GetChildren						

Record Object

You can open a Record object directly on a directory or a document. You can also open a Record based on the current record of a Recordset.
  1. Opening a Record object on a directory:

    Root directory:
    rec.Open "", "URL=http://server"

    docs directory:
    rec.Open "", "URL=http://server/docs"
    rec.Open "docs", "URL=http://server"

    mydocs directory:
    rec.Open "", "URL=http://server/docs/mydocs"
    rec.Open "mydocs", "URL=http://server/docs"
    rec.Open "docs/mydocs", "URL=http://server"
  2. Opening a Record on a file:
    rec.Open "myfile.txt", "URL=http://server/docs/mydocs"
    rec.Open "mydocs/myfile.txt", "URL=http://server/docs"
    rec.Open "docs/mydocs/myfile.txt", "URL=http://server"
  3. Opening a Record from a Recordset:The Record object is opened on the document/directory referenced by the current record in the Recordset.
    rs.Open "", "URL=http://server/docs/mydocs", , , adCmdTableDirectrec.Open rs						

Stream Object

The Stream object has a number of open modes that are not documented here. The following example is of opening a text document.
stm.Open "URL=http://server/docs/mydocs/myfile.txt", adModeRead
rec.Open "myfile.txt", "URL=http://server/docs/mydocs"stm.Open rec, adModeRead, adOpenStreamFromRecord				
rs.Open "myfile.txt", "URL=http://server/docs/mydocs", , , adCmdTableDirectrec.Open rsstm.Open rec, adModeRead, adOpenStreamFromRecord				
For more information on any of the above information, please refer to the Platform SDK for Windows 2000.

kbGrpMDAC kbDSupport kbMDAC250

Article ID: 245359 - Last Review: 02/28/2014 00:29:21 - Revision: 2.2

  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7
  • kbnosurvey kbarchive kbfix kbhowto KB245359