IFPCAccessProperties::URLSets property

Applies to: desktop apps only

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.

This property is read-only.

Syntax

HRESULT get_URLSets(
  IFPCRef **ppRefs
);
' Data type: FPCRefs

Property URLSets( _
  ByVal ppRefs As IFPCRef _
) 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.

Error codes

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

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.

Examples

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

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 (64-bit only)

Version

Forefront Threat Management Gateway (TMG) 2010

IDL

Msfpccom.idl

DLL

Msfpccom.dll

See also

FPCAccessProperties

 

 

Build date: 7/12/2010