URLSets Property of the IFPCAccessProperties Interface

The URLSets property gets an FPCRefs collection that contains references to the FPCURLSet collections defining the URL sets included in or excluded from the destinations to which the rule applies.

C++

HRESULT get_URLSets(
    IFPCRef** ppRefs
);

Parameters

  • ppRefs
    Address of a variable that receives a pointer to an IFPCRefs interface that represents the collection of references to the URL sets included in or excluded from the destinations to which the rule applies.

Return Value

This property method returns S_OK if the call is successful; otherwise, it returns an error code.

Visual Basic

Property URLSets As FPCRefs

Property Value

Reference to an FPCRefs collection that contains references to the URL sets included in or excluded from the destinations to which the rule applies.

Example Code

This VBScript script adds the user-specified domain name set to the destinations to which the user-specified access rule applies.

Option Explicit
'Define the constants needed
Const Error_FileNotFound = &H80070002
Const Error_AlreadyExists = &H800700B7
Const fpcPolicyRuleAccess = 0
Const fpcInclude = 0
Main(WScript.Arguments)
Sub Main(args)
    If(2 <> args.Count) Then
        Usage()
    End If
    AddUrlSetToAccessRule args(0), args(1)
End Sub
Sub AddUrlSetToAccessRule(ruleName, urlSetName)
    ' Create the root object.
    Dim root  ' The FPCLib.FPC root object
    Set root = CreateObject("FPC.Root")
    'Declare the other objects needed.
    Dim isaArray     ' An FPCArray object
    Dim rules        ' An FPCPolicyRules collection
    Dim rule         ' An FPCPolicyRule object
    Dim urlSets      ' An FPCURLSets colection
    Dim urlSet       ' An FPCURLSet object
    ' Get references to the array object, the policy rules collection, 
    ' and the URL sets collection.
    Set isaArray = root.GetContainingArray()
    Set rules = isaArray.ArrayPolicy.PolicyRules
    Set urlSets = isaArray.RuleElements.URLSets
    ' Retrieve the specified policy rule.
    On Error Resume Next
    Set rule = rules.Item(ruleName)
    If err.Number = Error_FileNotFound Then
        WScript.Echo "The access rule " & ruleName & " could not be found."
        WScript.Quit
    End If
    Err.Clear
    On Error GoTo 0
    ' Verify that the specified rule is an access rule.
    If rule.Type <> fpcPolicyRuleAccess Then
        WScript.Echo "The " & ruleName & " policy rule is not an access rule."
        WScript.Quit
    End If
    ' Verify that the specified URL set exists.
    On Error Resume Next
    Set urlSet = urlSets.Item(urlSetName)
    If err.Number = Error_FileNotFound Then
        WScript.Echo "The URL set " & urlSetName & " could not be found."
        WScript.Quit
    End If
    Err.Clear
    On Error GoTo 0
    ' Add the specified URL set to the destinations specified as URL sets
    ' to which the rule applies.
    On Error Resume Next
    rule.AccessProperties.URLSets.Add urlSetName, fpcInclude
    If err.Number = Error_AlreadyExists Then
        WScript.Echo "The URL set " & urlSetName & " is already referenced "  _
            & "by the access rule."
        WScript.Quit
    End If
    Err.Clear
    On Error GoTo 0
   ' Save the changes to the access rule.
    rule.Save
    WScript.Echo "Done!"
End Sub 
Sub Usage()
    WScript.Echo "Usage:" & VbCrLf _
        & "  " & WScript.ScriptName & " URLSetName RuleName" & VbCrLf _
        & "" & VbCrLf _
        & "  RuleName   - Access rule which will use the URLset" & VbCrLf _
        & "  URLSetName - URL set for specifying destinations"
    WScript.Quit
End Sub

Remarks

This property is read-only. It can be modified by calling the methods of the FPCRefs collection retrieved (the IFPCRefs interface retrieved in C++).

The IncludeStatus property of each reference specifies whether the URL set referenced is included in or excluded from the destinations to which the rule applies.

Requirements

Client Requires Windows 7 or Windows Vista.
Server Requires Windows Server 2008 R2 or Windows Server 2008 x64 Edition with SP2.
Version Requires Forefront Threat Management Gateway (TMG) 2010.
IDL

Declared in Msfpccom.idl.

DLL

Requires Msfpccom.dll.

See Also

FPCAccessProperties

Send comments about this topic to Microsoft

Build date: 6/30/2010