IsOrphan Property

       

Returns a Boolean that determines if the current page is an orphan. An orphan page is a page that cannot be reached by hyperlinks from the Home Page. Read-only.

expression.IsOrphan

expression   Required. An expression that returns one of the objects in the Applies To list.

Remarks

If True, the page cannot be reached from the Home Page. If False, the page can be reached from the Home Page.

Example

The following example searches through the current web and displays the names of all orphan files. An orphan file is denoted by its IsOrphan property. Once a file is found with an IsOrphan property that equals True, the Label property value is added to a String containing the names of all orphan nodes in the web. The String stored in the variable strName, is then displayed to the user. If no orphan nodes are found in the web, a message is displayed to the user.

Sub ListOrphans()
'Displays the names of orphan files.

    Dim objApp As FrontPage.Application
    Dim objWebFile As WebFile
    Dim strName As String
    Dim blnFound As Boolean

    Set objApp = FrontPage.Application

    blnFound = False
    'For each file in the web
    For Each objWebFile In ActiveWeb.AllFiles
        'Check if the file is an orpahn
        If objWebFile.IsOrphan Then
           blnFound = True
           If strName = "" Then
               strName = strName & objWebFile.Name
           Else
               'otherwise add next node label to string
               strName = strName & ", " & vbCr & objWebFile.Name
           End If
         End If
    Next

    If blnFound = True Then
       'Display names of all orphan pages
       MsgBox "The orphan pages in the current web are: " & vbCr & vbCr & _
              strName & "."
    Else
        'No orphans, display message
        MsgBox "There are no orphan pages in the web."
    End If

End Sub