Partager via


IMAExtensible2CallExport.OpenExportConnection Method

Begins an export run.

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

Usage

'Usage
Dim instance As IMAExtensible2CallExport
Dim configParameters As KeyedCollection(Of String, ConfigParameter)
Dim types As Schema
Dim exportRunStep As OpenExportConnectionRunStep

instance.OpenExportConnection(configParameters, types, exportRunStep)

Syntax

'Declaration
Sub OpenExportConnection ( _
    configParameters As KeyedCollection(Of String, ConfigParameter), _
    types As Schema, _
    exportRunStep As OpenExportConnectionRunStep _
)
void OpenExportConnection (
    KeyedCollection<string,ConfigParameter> configParameters,
    Schema types,
    OpenExportConnectionRunStep exportRunStep
)
void OpenExportConnection (
    KeyedCollection<String^, ConfigParameter^>^ configParameters, 
    Schema^ types, 
    OpenExportConnectionRunStep^ exportRunStep
)
void OpenExportConnection (
    KeyedCollection<String,ConfigParameter> configParameters, 
    Schema types, 
    OpenExportConnectionRunStep exportRunStep
)
function OpenExportConnection (
    configParameters : KeyedCollection<String,ConfigParameter>, 
    types : Schema, 
    exportRunStep : OpenExportConnectionRunStep
)

Parameters

  • types
    Contains a Schema that defines the management agent’s schema.

Remarks

Implement this method in all types of call-based connected data source extensions. All the exceptions that are described in this topic stop a run. If the method throws an exception that is not described in this topic, the run continues. If the run stops, the WMI Provider returns the string stopped-extension-dll-exception and generates an event log entry.

The PutExportEntries method is called if this method does not throw an exception. When an exception is thrown, the CloseExportConnection method is then called. If the PutExportEntries method throws an exception, the CloseExportConnection method is called to release the resources and disconnect the directory.

If any of the parameter information is needed by PutExportEntries or CloseExportConnection it is up to OpenExportConnection to store the information.

This should not be implemented for an import-only connection.

This method needs to store any parameters that are passed in and which the other methods need.

The following is an example of OpenExportConnection:

   public void OpenExportConnection(KeyedCollection<string, ConfigParameter> configParameters,
                                Schema types,
                                OpenExportConnectionRunStep exportRunStep)
        {
            // Save the import operation to use in PutExportEntries()
            m_exportOperation = exportRunStep.ExportType;
 
            // We do not use all the configParameters, which contain connection
            // details, in the sample but if one were to connect to a 
            // foreign system, they would use these parameters to do so.
 
            XmlWriterSettings xmlSettings = new XmlWriterSettings();
 
            // Determine encoding from Configuration Parmeters
            string encoding = configParameters["Export Encoding"].Value;
            if (encoding.Equals("ASCII"))
            {
                xmlSettings.Encoding = Encoding.ASCII;
            }
            else if (encoding.Equals("UTF8"))
            {
                xmlSettings.Encoding = Encoding.UTF8;
            }
            else
            {
                xmlSettings.Encoding = Encoding.Unicode;
            }
 
            // Use a run step config paramater to control Xml declaration
            string omitXmlDecl = configParameters["Omit Xml Declaration"].Value;
            if (omitXmlDecl.Equals("1"))
            {
                xmlSettings.OmitXmlDeclaration = true;
            }
 
            // Begin XML file
            m_xmlWriterExport = XmlTextWriter.Create(MAUtils.MAFolder + @"\sample_export.xml", xmlSettings);
            m_xmlWriterExport.WriteStartElement(Nodes.Root);
            m_xmlWriterExport.WriteAttributeString(Nodes.FullExport, (OperationType.Full == m_exportOperation) ? "true" : "false");
 
            // Include partition DN
            m_xmlWriterExport.WriteElementString(Nodes.PartitionDN, exportRunStep.StepPartition.DN);
        }

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

IMAExtensible2CallExport Interface
IMAExtensible2CallExport Members
Microsoft.MetadirectoryServices Namespace