IFPCUserAgentMappings::MoveUp method
Applies to: desktop apps only
The MoveUp method moves the specified User-Agent mapping one step up the list of User-Agent mappings, which corresponds to the order in which the User-Agent mappings are tested to find a mapping that matches the User-Agent header in a request. If the first mapping in the list does not match the User-Agent header in a request, the second mapping is tested, and so on.
Syntax
HRESULT MoveUp(
[in] Long index,
[in] long index
);
FPCUserAgentMappings.MoveUp( _
ByVal index As Long, _
ByVal index As long _
)
Parameters
index [in]
C++ Required. Index (the current position indicated by the Order property of the IFPCUserAgentMapping interface) of the User-Agent mapping to move up.
VB Required. Index (the current position indicated by the Order property of the FPCUserAgentMapping object) of the User-Agent mapping to move up.
Return value
C++
This method returns S_OK if the call is successful; otherwise, it returns an error code.
VB
This method has no return values. If the call is unsuccessful, an error is raised that can be intercepted by using an error handler.
Remarks
Use the MoveDown method to move a User-Agent mapping one step down the list of User-Agent mappings.
Examples
This VBScript script moves the specified User-Agent mapping one step up the list of User-Agent mappings.
Option Explicit
' Define the constant needed.
Const Error_TypeMismatch = &HD
const Error_InvalidParameter = &H80070057
Main(WScript.Arguments)
Sub Main(args)
If(args.Count <> 1) Then
Usage()
Else
MoveUpMapping args(0)
End If
End Sub
Sub MoveUpMapping(mappingId)
' 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 mappings ' An FPCUserAgentMappings collection
' Get references to the array object and
' the User-Agent mappings collection.
Set isaArray = root.GetContainingArray()
Set mappings = isaArray.RuleElements.UserAgentMappings
' Move up the specified User-Agent mapping.
On Error Resume Next
mappings.MoveUp(CInt(mappingId))
If Err.Number = Error_TypeMismatch Then
WScript.Echo "The Mapping parameter specified is not a number."
WScript.Quit
ElseIf Err.Number = Error_InvalidParameter Then
WScript.Echo "The mapping specified cannot be moved or does not exist."
WScript.Quit
Else
WScript.Echo "Moving the User-Agent mapping specified up..."
End If
On Error GoTo 0
' Save the changes to the collection of User-Agent mappings.
mappings.Save
WScript.Echo "Done!"
End Sub
Sub Usage()
WScript.Echo "Usage:" & VbCrLf _
& " " & WScript.ScriptName & " Mapping" & VbCrLf _
& "" & VbCrLf _
& " Mapping Number of the mapping."
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
Build date: 7/12/2010