AnsweredAssumed Answered

How to Convert a GlobalID field to a GUID field.

Question asked by jsn on Feb 18, 2016
Latest reply on Mar 24, 2019 by rbae

Hello everyone,


I am testing the code below and it does not change the type of the field GLOBALID from GlobalId to GUID




ArcObjects 10 .NET SDK Help



- ArcGIS 10.2


- SDE based on Oracle 11G


- Visual Studio 2010.



' Converts a GlobalID field to a GUID field.
    Public Sub ConvertGlobalIdToGuid(ByVal workspace As IWorkspace, ByVal datasetName As String)
        ' Open the table.
        Dim featureWorkspace As IFeatureWorkspace = CType(workspace, IFeatureWorkspace)
        Dim table As ITable = featureWorkspace.OpenTable(datasetName)

        ' Get the GlobalID field.
        Dim classEx As IClassEx = CType(table, IClassEx)
        If Not classEx.HasGlobalID Then
            Throw New Exception(String.Format("No GlobalID column in table: {0}.", datasetName))
        End If
        Dim globalIDFieldName As String = classEx.GlobalIDFieldName


        ' Convert the GlobalID column to a GUID column.
        Dim classSchemaEditEx As IClassSchemaEditEx = CType(table, IClassSchemaEditEx)

        Catch ex As Exception
            Console.WriteLine("Could Not Open Geodatabase")
            Console.WriteLine("{0} ", ex.Message)
        End Try
    End Sub