Select to view content in your preferred language

Insufficient Permissions when using IFeatureClass.CreateFeature

772
2
10-27-2011 07:03 AM
TravisSparks
Emerging Contributor
I have connected successfully to an sde database using an IFeatureWorkspace, and have an IFeatureClass object for the feature class I want to work with.  When connected as a user that is NOT the owner of any feature classes, but that does have SELECT, INSERT, UPDATE, and DELETE permissions (using ISQLPrivilege) on the feature class, I am able to update existing features, but not create new ones.

To update, I use the IFeatureClass.GetFeature method to return an IFeature, I update the appropriate field values, and I call IFeature.Store, which updates the feature in the feature class successfully.  However, if I use IFeatureClass.CreateFeature to create a new feature to store in the feature class, I get an 'Insufficient Permissions' error.

I've tried wrapping the operations in an IWorkspaceEdit edit session and edit operation, but that doesn't have any effect in this case.  If I connect as the feature class owner, this all works fine, so it would seem that the approach is ok, minus this permission issue.

Any ideas?

Thanks
0 Kudos
2 Replies
NeilClemmons
Honored Contributor
What happens when you try creating a new feature in this feature class using ArcMap?  If you get a similar error then the problem is probably on the database side rather than in your code.
0 Kudos
TravisSparks
Emerging Contributor
It turns out I hadn't set the user privileges on the feature class inside ArcCatalog.  Is there some way to determine these feature class permissions via code?  I've been using the following, where PrimaryCPFeatureClass is a populated feature class:

IDataset dataset = (IDataset)PrimaryCPFeatureClass;
IDatasetName datasetName = (IDatasetName)dataset.FullName;
ISQLPrivilege sqlPriv = (ISQLPrivilege)datasetName;

The sqlPriv object was providing the privileges as they exist on the underlying SQL table, but apparently not the privileges of the sde feature class itself, which is what I need access to.
0 Kudos