Hi,
I solved this problem by creating the following function:
private static async Task AddField(string table, string fieldName, string fieldType, string precision = "",
string scale = "", string length = "", string alias = "")
{
List<object> arguments = new List<object>();
arguments.Add(table);
arguments.Add(fieldName);
arguments.Add(fieldType);
arguments.Add(precision);
arguments.Add(scale);
arguments.Add(length);
arguments.Add(alias);
IGPResult result = await Geoprocessing.ExecuteToolAsync(
"management.AddField", Geoprocessing.MakeValueArray(arguments.ToArray())
);
}
Then i just call it like
await AddField(exportFeatureClass, "TextFieldName", "TEXT", length: "16");
You don't have to use the QueuedTask.Run() because in this case none of the used method's require the MCT to run.
If you want to add multiple fields you'll have to que them (internally this happens with AddFields_management).
You could do this in a loop, or by calling the function for every field you want to add.
Best regards,
Gwen.