Select to view content in your preferred language

Determine if a dataset is registered as versioned using the Pro SDK

210
3
Jump to solution
a week ago
ujr_esrich
New Contributor

Hi community, I am wondering if there is a way to determine if a table or feaure class in a geodatabase is registered as versioned. With ArcPy, I could use arcpy.Describe("MyDataset").isVersioned (or isTraditionalVersioned or isBranchVersioned). Is there an equivalent in the Pro SDK? I appreciate any hints.

Tags (4)
0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

Sample from ArcGIS Pro API Reference:

public bool IsTableVersioned(Geodatabase geodatabase, string tableName)
{
    using (Table table = geodatabase.OpenDataset<Table>(tableName))
    {
        // Check table version type
        RegistrationType registrationType = table.GetRegistrationType();
        if (registrationType == RegistrationType.Versioned)
        {
            return true;
        }
    }
    return false;
}

 

 

View solution in original post

3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Sample from ArcGIS Pro API Reference:

public bool IsTableVersioned(Geodatabase geodatabase, string tableName)
{
    using (Table table = geodatabase.OpenDataset<Table>(tableName))
    {
        // Check table version type
        RegistrationType registrationType = table.GetRegistrationType();
        if (registrationType == RegistrationType.Versioned)
        {
            return true;
        }
    }
    return false;
}

 

 

Aashis
by Esri Contributor
Esri Contributor

In addition to @GKmieliauskas, to find a versioning type ( Branch or Traditional),  versionManager.GetVersioningType() should be called. Please refer to the Pro conceptual doc.

0 Kudos
ujr_esrich
New Contributor

Hi @GKmieliauskas and @Aashis, thanks a lot, this works fine for me. I must have overlooked Dataset.GetRegistrationType() when I was first looking into this. In my (still limited) experience, dataset.GetRegistrationType() works fine, even if dataset is from a Geodatabase gdb with gdb.IsVersioningSupported() == false; in this case it returns Nonversioned, which makes sense and is convenient.

0 Kudos