DestinationDomainNameSets Property of the IFPCAccessProperties Interface

The DestinationDomainNameSets property gets an FPCRefs collection that contains references to the FPCDomainNameSet collections defining the destination domain name sets included in or excluded from the destinations to which the rule applies.

[C++]
HRESULT get_DestinationDomainNameSets(
	IFPCRefs** ppRefs
);

Parameters

ppRefs

Address of an interface pointer that on return points to an IFPCRefs interface that represents the collection of references to the destination domain name 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 DestinationDomainNameSets As FPCRefs

Property Value

Reference to an FPCRefs collection that contains references to the destination domain name 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
	AddDomainNameSetToAccessRule args(0), args(1)
End Sub
Sub AddDomainNameSetToAccessRule(ruleName, dnsetName)
	' 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 dnSets	 ' An FPCDomainNameSets colection
	Dim dnSet		' An FPCDomainNameSet object
	' Get references to the array object, the policy rules collection, 
	' and the domain name sets collection.
	Set isaArray = root.GetContainingArray()
	Set rules = isaArray.ArrayPolicy.PolicyRules
	Set dnSets = isaArray.RuleElements.DomainNameSets
	' 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 domain name set exists.
	On Error Resume Next
	Set dnSet = dnSets.Item(dnsetName)
	If err.Number = Error_FileNotFound Then
		WScript.Echo "The domain name set " & dnsetName & " could not be found."
		WScript.Quit
	End If
	Err.Clear
	On Error GoTo 0
	' Add the specified domain name set to the destinations specified as domain name sets
	' to which the rule applies.
	On Error Resume Next
	rule.AccessProperties.DestinationDomainNameSets.Add dnsetName, fpcInclude
	If err.Number = Error_AlreadyExists Then
		WScript.Echo "The domain name set " & dnsetName & " 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 & " DomainNameSetName RuleName" & VbCrLf _
		& "" & VbCrLf _
		& "  RuleName		- Access rule which will use the domain name set" & VbCrLf _
		& "  DomainNameSetName - Domain name 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 domain name set referenced is included in or excluded from the destinations to which the rule applies.

Requirements

Client Requires Windows Vista or Windows XP.
Server Requires Windows Server 2008.
Version Requires Forefront Threat Management Gateway (TMG).
IDL

Declared in Msfpccom.idl.

DLL

Requires Msfpccom.dll.

See Also

FPCAccessProperties


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.