ImportFromFile Method of the IFPCPersist Interface

The ImportFromFile method recursively copies the values of all the properties of the object and of its subobjects from the specified XML file to persistent storage. For a collection, the method also imports all of its elements and their properties from the XML file. This method also writes any unsaved configuration changes that were made before the method was called to persistent storage.

[C++]

Syntax

HRESULT ImportFromFile(
  [in]			BSTR XmlFileName,
  [in]			long OptionalData,
  [in, optional]  BSTR EncryptionPassword,
  [in, optional]  VARIANT_BOOL CleanCollections,
  [in, optional]  VARIANT_BOOL fResetRequiredServices,
  [in, optional]  VARIANT_BOOL fReloadConfiguration
);

Parameters

XmlFileName
BSTR that specifies the name of the XML file from which the data will be imported.
OptionalData

A 32-bit integer value that specifies what optional data to include in the import. This value is a bitwise combination of values from the FpcExportImportOptionalData enumerated type. The bits set should not call for the inclusion of optional data in the import that were not included in the export.

EncryptionPassword
BSTR that specifies a password for importing encrypted information. This parameter is an empty string by default. The password is required if the export was performed using an encryption password.
CleanCollections
Boolean value that indicates whether to remove existing objects that are not included in the XML file. The default value is VARIANT_FALSE. If this parameter is set to VARIANT_TRUE in a call to the ImportFromFile method on any interface other than the IFPCArray interface, the call will fail. If the ImportFromFile method is called on the FPCArray object to import an array configuration that was exported from one Forefront TMG installation to another installation, this parameter must be set to VARIANT_TRUE.
fResetRequiredServices
Boolean value that indicates whether to restart the services that need to be restarted for the changes to take effect. The default value is VARIANT_FALSE.
fReloadConfiguration
This parameter is provided for compatibility with ISA Server. The default value is VARIANT_TRUE. In Forefront TMG, this parameter is ignored.

Return Value

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

[Visual Basic]

Syntax

Sub ImportFromFile( _
  ByVal XmlFileName As String, _
  ByVal OptionalData As Long, _
  [ ByVal EncryptionPassword As String ], _
  [ ByVal CleanCollections As Boolean ], _
  [ ByVal fResetRequiredServices As Boolean ], _
  [ ByVal fReloadConfiguration As Boolean ] _
)

Parameters

XmlFileName
String that specifies the name of the XML file from which the data will be imported.
OptionalData

A 32-bit integer value that specifies what optional data to include in the import. This value is a bitwise combination of values from the FpcExportImportOptionalData enumerated type. The bits set should not call for the inclusion of optional data in the import that were not included in the export.

EncryptionPassword
String that specifies a password for importing encrypted information. This parameter is an empty string by default. The password is required if the export was performed using an encryption password.
CleanCollections
Boolean value that indicates whether to remove existing objects that are not included in the XML file. The default value is False. If this parameter is set to True in a call to the ImportFromFile method on any object other than the FPCArray object, the call will fail. If the ImportFromFile method is called on the FPCArray object to import an array configuration that was exported from one Forefront TMG installation to another installation, this parameter must be set to True.
fResetRequiredServices
Boolean value that indicates whether to restart the services that need to be restarted for the changes to take effect. The default value is False.
fReloadConfiguration
This parameter is provided for compatibility with ISA Server. The default value is True. In Forefront TMG, this parameter is ignored.

Return Value

This method has no return values. If the call is unsuccessful, an error is raised that can be intercepted by using an error handler.

Example Code

For a VBScript code example that shows how to use this method to import the configuration stored in a specified .xml file to a Forefront TMG computer, see Exporting and Importing a Forefront TMG Configuration.

Remarks

Imported configuration changes are applied only after the new settings are written to persistent storage and reloaded to the services that use them. Most changes can be applied dynamically without restarting any services. However, some changes can take effect only after the Microsoft Firewall service is restarted. For more information, see Restarting Services After Configuration Changes.

Forefront TMG maintains a bitmask that specifies which services need to be started for the unsaved configuration changes to take effect. This bitmask can be retrieved by calling the GetServiceRestartMask method. Calling the ImportFromFile method clears all of the bits in this bitmask even if the fResetRequiredServices parameter is set to False (VARIANT_FALSE in C++).

For more information, see About Persistence.

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

FPCPersist


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.

[an error occurred while processing this directive]