Hi Team,
I am using ArcGIS Runtime 100.14.1
I have a public ArcGIS Feature Server with Attachments enabled.
Using the rest interface I am able to add attachments to existing points.
Dummy Sample URL: https://domain.com/arcgis/rest/services/ProdFolder/DataCollect/FeatureServer/0/1/addAttachment
However in my Runtime code I am using AddAttachmentAsync with all the correct parameters.
I do not get any exceptions and the point gets added successfully.
When I check the Map in ArcGIS Online map viewer I do not see the attachments.
Is this a known issue?
Any suggestions would be very helpful.
public async void AddAttachmentImageInFeature()
{
try
{
var popupResult = new AddAttachmentModel { filemodelList = null, };
var result = await Navigation.ShowPopupAsync(new AddAttachmentsPopUpPage(popupResult));
if (result != null)
{
UserDialogs.Instance.ShowLoading();
if (_selectedFeature.CanEditAttachments)
{
try
{
foreach (var item in result.filemodelList)
await _selectedFeature.AddAttachmentAsync(item.filename, item.contenttype, item.applicationData);
ServiceFeatureTable serviceTable = (ServiceFeatureTable)_selectedFeature.FeatureTable;
await serviceTable.ApplyEditsAsync();
_selectedFeature.Refresh();
feature.Refresh();
UserDialogs.Instance.HideLoading();
await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Success!", "Successfully added feature and attachment", "OK");
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
// Create and remove a graphic from the geometry the user drew
if (Helpers.Constant.selectedLayer.name == "AOI Polygon" || Helpers.Constant.selectedLayer.name == "AOI Lines")
{
Graphic graphic = CreateGraphic(Polygonegeometry);
_sketchOverlay.Graphics.Clear();
_sketchOverlayforfeature.Graphics.Clear();
}
CompleteButton.IsVisible = false;
AddButton.IsVisible = false;
UnduButton.IsVisible = false;
IsDrawStart = false;
linePoints.Clear();
}
else
{
// Create and remove a graphic from the geometry the user drew
if (Helpers.Constant.selectedLayer.name == "AOI Polygon" || Helpers.Constant.selectedLayer.name == "AOI Lines")
{
Graphic graphic = CreateGraphic(Polygonegeometry);
_sketchOverlay.Graphics.Clear();
_sketchOverlayforfeature.Graphics.Clear();
}
_selectedFeature.Refresh();
feature.Refresh();
CompleteButton.IsVisible = false;
AddButton.IsVisible = false;
UnduButton.IsVisible = false;
IsDrawStart = false;
linePoints.Clear();
}
}
catch (Exception exception)
{
await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Error adding attachment", exception.ToString(), "OK");
}
}
Best regards,
Gurminder
Hi,
Can you share the code where you're creating/updating the feature and attachment, adding to the table, and applying the edits to the service?
Thanks
@MichaelBranscomb I have updated my post with the code.
I have not been able to reproduce this, although without the full code / repro my repro would be different from your exact case.
I recommend taking a look at our sample code for EditFeatureAttachments and comparing that with your app logic.