Value Property of the IFPCVendorParametersSet Interface

The Value property gets or sets the value associated with the parameter name supplied.

[C++]
HRESULT put_Value(
	BSTR bstrName,
	VARIANT vValue
);
HRESULT get_Value(
	BSTR bstrName,
	VARIANT* pvValue
);

Parameters

bstrName

Name of the parameter for which the value is to be retrieved or set.

pvValue

Pointer to a VARIANT that on return receives the value associated with the parameter name specified in the Name parameter. The value can be of any subtype defined in the VARIANT type and is not necessarily a string.

vValue

Value to be associated with the parameter name specified in the Name parameter. The value can be of any subtype defined in the VARIANT type and is not necessarily a string.

Return Value

These property methods return S_OK if the call is successful; otherwise, they return an error code.

[Visual Basic]
Property Value( _
  ByVal Name As String _
) As Variant

Parameters

Name

Name of the parameter for which the value is to be retrieved or set.

Property Value

Value associated with the parameter name specified in the Name parameter. The value can be of any subtype defined in the Variant type and is not necessarily a string.

Example Code

The FPCVendorParametersSet object is used to store data that is defined as {name, value} pairs by using the Value property. The following example stores a parameter named x having a value of 1:

Dim vps As FPCVendorParametersSet
...
vps.Value("x") = 1
The expression "Value("x")" will return the value. The Value property is also the default property. The following examples are equivalent:
vps.Value("x") 
vps("x")

Remarks

This property is read/write.

In C#, the Value property is not available, but parameters can still be added, displayed, and removed. The following code example demonstrates how to add, display, and remove parameters in a vendor parameters set for the policy rule specified by the user in C#.

[C#]

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Microsoft.Isa.Interop;

namespace VpsExample
{
	class VendorParameters
	{
		const string VpsGUID = "{20CD9353-223D-455D-9BA6-C88273978CDC}";
		const Int32 Error_AlreadyExists = -2147024713; // 0x800700B7
		private static FPC m_Root;
		private static FPCArray m_Array;
		private static FPCPolicyRule m_Rule;
		private static FPCVendorParametersSets m_VpSets;
		private static FPCVendorParametersSet m_VpSet;
		static void Main(string[] args)
		{
			string RuleName;
			if (args.Length != 1)
			{
				Console.WriteLine("You must type the name of a rule.");
				return;
		}
			RuleName = args[0];

			// Create the root object.
			m_Root = new FPC();

			// Get references to the array object, a
			// policy rule, and its vendor parameters sets collection.
			m_Array = m_Root.GetContainingArray();
			m_Rule = m_Array.ArrayPolicy.PolicyRules.Item(RuleName);
			m_VpSets = m_Rule.VendorParametersSets;
		 
			try
			{
				m_VpSet = m_VpSets.Add(VpsGUID, false, false); 		
		}
			catch (COMException comEx)
			{
				if (comEx.ErrorCode == Error_AlreadyExists)
				{
					m_VpSet = m_VpSets.Item(VpsGUID);
					Console.WriteLine("Using existing VPS");
			}
		}
			// Create parameters in the vendor parameters set.
			m_VpSet["x"] = 1;
			m_VpSet["y"] = 2;
			m_VpSet["z"] = 3;
			// Remove one of the parameters that was just added.
			m_VpSet.RemoveValue("y");
			m_VpSets.Save(false, true);


			// Display the GUIDs of all the vendor parameters sets 
			// associated with the rule followed by their parameters.
			if(m_VpSets.Count > 0)
			{
				Console.WriteLine("The vendor parameters sets for {0} are:", m_Rule.Name);
				foreach(FPCVendorParametersSet vpSet in m_VpSets)
				{
					Console.WriteLine("VP Set GUID: {0}", vpSet.Name);
				
					object[] allNames = (object[])vpSet.AllNames;
					int index = 1;
					foreach(string name in allNames)
					{
						Console.WriteLine("   {0}. {1} = {2}", index, name, vpSet[name]);
						index = index + 1;
				}
			}
				m_VpSets.Remove(VpsGUID);
			 // m_VpSets.Save(false, true);
		}
			else
			{
				Console.WriteLine("The collection of vendor parameters sets for the {0} rule is empty.", m_Rule.Name);
		}
			Console.WriteLine("\r\nDone!");
	}
}
}

For more information about writing code in C# that uses the Forefront TMG administration COM objects, see Getting Started with Administration COM Objects.

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

FPCVendorParametersSet


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.