ESRI Add-In - ArcMap License Binding, Change to License.GeodatabaseUpdate

450
0
05-15-2018 04:16 PM
JamesKennedy1
New Contributor III

Hello,

Ultimately I am trying to add Field to a FeatureClass using the below method within an ESRI Add-In for ArcMap written in C#

        public void AddFieldToFeatureClass(IFeatureClass featureClass, IField field)
        {
            ISchemaLock schemaLock = (ISchemaLock)featureClass;
            try {
                // A try block is necessary, as an exclusive lock might not be available.
                schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
                // Add the field.        
                featureClass.AddField(field);
            }
            catch (Exception exc) {
                // Handle appropriately for your application.
                Console.WriteLine(exc.Message);
            }
            finally {
                // Set the lock to shared, whether or not an error occurred.
                schemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
            }
        }

Now when I try this, I receive the following error:

"exc.Message = "The application is not licensed to create or modify schema for this type of data ""

After doing searching for this error I see that the problem is my license and I need to bind it to one that will allow me to use this method.

So I chose the following:

ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.EngineOrDesktop, ESRI.ArcGIS.LicenseLevel.GeodatabaseUpdate);

Which then results in the new following error:

"Additional information: Unable to initialize an ArcGIS 10.5 license. This process is already initialized to Basic which is not one of the requested licenses: Engine Geodatabase Update, Standard, Advanced"

It is here that I do not necessarily know what to do. I have looked for "unbind" methods to allow me to reinitialize the license type somehow. I have not found any, as they probably do not exist.

How do I go about doing this?

Is there something in ArcMap I should change within ArcGIS Administrator?

Thank you for your time.

Tags (2)
0 Kudos
0 Replies