This document is archived and information here might be outdated.  Recommended version.


IVersion2.CreateChild Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (GeoDatabase)  

IVersion2.CreateChild Method

Creates a new child version of this version whose initial state is the current state of pInitialStateVersion.

[Visual Basic .NET]
Public Function CreateChild ( _
    ByVal Name As String, _
    ByVal initialStateVersion As IVersion _
) As IVersion
[C#]
public IVersion CreateChild (
    string Name,
    IVersion initialStateVersion
);
[C++]
HRESULT CreateChild(
  BSTR Name,
  IVersion* initialStateVersion,
  IVersion** newChildVersion
);
[C++]

Parameters Name [in] Name is a parameter of type BSTR initialStateVersion [in]
initialStateVersion is a parameter of type IVersion newChildVersion [out, retval]
newChildVersion is a parameter of type IVersion

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

This method is intended for developers who require custom workflows such as creating a version with an initial state that references a version other than that of the parent version. To create a child version with the same initial state as the parent version, use the IVersion.CreateVersion method.

[C#]

The example below assumes the existence of a version named QA that has a child version named EditorA. A new version, EditorB, is being created as a child version of the QA version, but rather than initially referencing the same state of the parent QA version, it will reference the same state of its sibling version, EditorA.

 

public void CreateChildExample(IWorkspace workspace)
{
      // Open the QA and EditorA versions.
      IVersionedWorkspace versionedWorkspace=(IVersionedWorkspace)workspace;
      IVersion2 qaVersion=(IVersion2)versionedWorkspace.FindVersion("QA");
      IVersion2 editorAVersion=(IVersion2)versionedWorkspace.FindVersion("EditorA");
 
      // Create EditorB with the same state as EditorA.
      IVersion2 editorBVersion=(IVersion2)qaVersion.CreateChild("EditorB", editorAVersion);
}

See Also

IVersion2 Interface