ERROR
This error may be returned when creating text files using the TextFileWorkspaceFactory:
-2147220987 The user does not have permission to execute the operation.
The .txt extension is missing from the file name.
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, "")
Get help from ArcGIS experts
Download the Esri Support App