GetDataPaths

The GetDataPaths method can be used with any of the IIS Admin Objects to find the paths to metabase keys where a specified property is located. This method can be used to find occurrences of a property that may be blocking inherited values from subordinate keys. The path search will start at the key associated with the object you use this method with and will return the starting path if the property is located at that key. For example, if you use this method with the IIsWebServer object for the third Web server, the search path would start at IIS://LocalHost/W3Svc/3 and would return the paths IIS://LocalHost/W3Svc/3, IIS://LocalHost/W3Svc/3/ROOT/VDir1, and IIS://LocalHost/W3Svc/3/ROOT/VDir1/Dir1/File1 if those were the keys where the property was found.

A parameter to the method enables you to specify whether to search for the paths of an inheritable property or for the paths of a property regardless of whether or not it is inheritable. You can use this method to determine if a property is inheritable as well as where occurrences of it are located.

Syntax

PathList = object.GetDataPaths(Property, AttributeFlag)
 

Parts

PathList
Receives the list of paths to occurrences of the specified property.
object
An IIS Admin Object. Usually the result of a previous GetObject operation.
Property
The name of the property whose paths are to be located.
AttributeFlag
One of the following flags:
IIS_ANY_PROPERTY Retrieve paths regardless of whether or not the property is inheritable.
IIS_INHERITABLE_ONLY Retrieve paths only if the property is inheritable. Return MD_ERROR_DATA_NOT_FOUND if property is not inheritable.

Remarks

You can use the For each Path in PathList...Next statement to retrieve individual paths from PathList.

Code Example

<% 
Const IIS_ANY_PROPERTY = 0 
Const IIS_INHERITABLE_ONLY = 1 
Const MD_ERROR_DATA_NOT_FOUND = &H800CC801 
Dim WebSvrObj, PathList, vProperty 
On Error Resume Next 
' Get the object for the first Web server 
Set WebSvrObj = GetObject("IIS://LocalHost/W3SVC/1") 
' Get the paths where a property is located 
vProperty = "AccessFlags" 
PathList = WebSvrObj.GetDataPaths(vProperty, IIS_INHERITABLE_ONLY) 
If Err.Number = 0 Then 
    Response.Write "Paths for property " & vProperty & "<BR>" 
    For each Path in PathList 
        Response.Write Path & "<BR>" 
    Next 
ElseIf Err.Number = MD_ERROR_DATA_NOT_FOUND Then 
    Response.Write "Property is not inheritable.<BR>" 
ElseIf Err.Number = &H80005006 Then 
    Response.Write "Property does not exist.<BR>" 
Else 
    Response.Write "Error " & Err.Number & "  " & Err.Description 
End If
%> 
 

© 1997 by Microsoft Corporation. All rights reserved.