GetDataPaths

The ADSI 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 could be preventing subkeys from inheriting values. The path search will start at the key associated with the object you use GetDataPaths with, and will return the starting path if the property is located at that key. For example, if you use GetDataPaths 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 of the method enables you to specify whether to limit your search to seeking only paths of an inheritable property, or all property paths. You can use GetDataPaths 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
Contains an IIS Admin Object, usually as a 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 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
%>