ERROR

-2147220987 The user does not have permission to execute the operation.

Last Published: April 25, 2020

Error Message

This error may be returned when creating text files using the TextFileWorkspaceFactory:

-2147220987 The user does not have permission to execute the operation.

Cause

The .txt extension is missing from the file name.

Solution or Workaround



Make sure the .txt extension is supplied with the name of the file to be created. For example:

Code:
Dim pWorkspace As IWorkspace
Dim pFact As IWorkspaceFactory
Dim pfeatworkspace As IFeatureWorkspace
Dim ptable As ITable
Dim pFieldsEdit As esriCore.IFieldsEdit
Dim pFieldEdit As esriCore.IFieldEdit
Dim pField As IField
Dim pfields As IFields

Set pFact = New TextFileWorkspaceFactory
Set pWorkspace = pFact.OpenFromFile("d:\mydata\textfiles", 0)
Set pfeatworkspace = pWorkspace
Set pfields = New esriCore.Fields
Set pFieldsEdit = pfields
pFieldsEdit.FieldCount = 1

'-- Create string Field
Set pField = New Field
Set pFieldEdit = pField
With pFieldEdit
.Length = 30
.Name = "TextField"
.Type = esriFieldTypeString
End With
Set pFieldsEdit.Field(0) = pField

'-- Specify the name of the output file
Set ptable = pfeatworkspace.CreateTable("mytable.txt", pfields, Nothing, Nothing, "")

Article ID:000004530

Software:
  • ArcMap 8 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic