Delen via


IMAExtensible2FileImport.WriteImportFile Method

Generates an export dump of the connected system. It is called once the beginning of an import run. If the dump file is not created an error is raised.

Namespace: Microsoft.MetadirectoryServices
Assembly: Microsoft.MetadirectoryServicesEx (in Microsoft.MetadirectoryServicesEx.dll)

Usage

'Usage
Dim instance As IMAExtensible2FileImport
Dim configParameters As KeyedCollection(Of String, ConfigParameter)
Dim types As Schema
Dim importRunStep As WriteImportFileRunStep
Dim returnValue As WriteImportFileResults

returnValue = instance.WriteImportFile(configParameters, types, importRunStep)

Syntax

'Declaration
Function WriteImportFile ( _
    configParameters As KeyedCollection(Of String, ConfigParameter), _
    types As Schema, _
    importRunStep As WriteImportFileRunStep _
) As WriteImportFileResults
WriteImportFileResults WriteImportFile (
    KeyedCollection<string,ConfigParameter> configParameters,
    Schema types,
    WriteImportFileRunStep importRunStep
)
WriteImportFileResults^ WriteImportFile (
    KeyedCollection<String^, ConfigParameter^>^ configParameters, 
    Schema^ types, 
    WriteImportFileRunStep^ importRunStep
)
WriteImportFileResults WriteImportFile (
    KeyedCollection<String,ConfigParameter> configParameters, 
    Schema types, 
    WriteImportFileRunStep importRunStep
)
function WriteImportFile (
    configParameters : KeyedCollection<String,ConfigParameter>, 
    types : Schema, 
    importRunStep : WriteImportFileRunStep
) : WriteImportFileResults

Parameters

  • types
    Contains a Schema that defines the management agent’s schema.
  • importRunStep
    Contains a WriteImportFileRunStep object which contains custom data for the partition we are importing against. The value written back is stored in the server for a future run. It also contains a string with the name of the text file that will contain the dump of the connected system. It also has the partition information, full import or delta import, etc.

Return Value

Returns the WriteImportFileResults object that contains the custom data..

Remarks

Exceptions: Return values, Errors, and Exceptions

The following is an example of WriteImportFile:

 public WriteImportFileResults WriteImportFile(
                                                KeyedCollection<string, ConfigParameter> configParameters,
                                                Schema types,
                                                WriteImportFileRunStep importRunStep)
        {
           
            StreamReader sr = new StreamReader(exportRunStep.FilePath, Encoding.Unicode);
            string lineContents = null;
            lineContents = sr.ReadLine();
            while (null != (lineContents = sr.ReadLine()))
            {
                char[] commaEscape = new char[] { ',' };
                char[] quoteEscape = new char[] { '"' };
                string[] valueComponents = lineContents.Split(commaEscape);

 
                if (Nodes.ObjectClass == valueComponents[0].Trim(quoteEscape))
                {
                    continue;
                }

                return new WriteImportFileResults();
            }
        }

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Target Platforms

Change History

See Also

Reference

IMAExtensible2FileImport Interface
IMAExtensible2FileImport Members
Microsoft.MetadirectoryServices Namespace