<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add attachment to a feature using Xamarin Android in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711812#M8966</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yifan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried to set up&amp;nbsp;&lt;STRONG&gt;&lt;SPAN style="color: #000000;"&gt;GenerateGeodatabaseParameters&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;AttachmentSyncDirection &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;to sets the direction for the attachments to be synchronized.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/net/latest/wpf/api-reference//html/P_Esri_ArcGISRuntime_Tasks_Offline_GenerateGeodatabaseParameters_AttachmentSyncDirection.htm" title="https://developers.arcgis.com/net/latest/wpf/api-reference//html/P_Esri_ArcGISRuntime_Tasks_Offline_GenerateGeodatabaseParameters_AttachmentSyncDirection.htm"&gt;GenerateGeodatabaseParameters.AttachmentSyncDirection Property&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Hope that helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Nagma&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Aug 2017 23:07:19 GMT</pubDate>
    <dc:creator>NagmaYasmin</dc:creator>
    <dc:date>2017-08-02T23:07:19Z</dc:date>
    <item>
      <title>Add attachment to a feature using Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711811#M8965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am adding an attachment to a feature on the feature service. My issue is I am able to add the attachment to the feature, but I am not sure how to push the attachment to the feature service. Here is what I did:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;async&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;save&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;LoadAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// bytes is the byte array containing data of the file&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;AddAttachmentAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;App&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_file&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;@"image/"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; bytes&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; ServiceFeatureTable sft &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FeatureTable &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; ServiceFeatureTable&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; sft&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;UpdateFeatureAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; sft&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ApplyEditsAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debugging shows that feature.AddAttachmentAsync() works as expected. After that line, I tried feature.GetAttachmentAsync() and it returns the just added attachment. However, I was not able to sync the attachment to the feature service. That feature service has attachment enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing any steps here? Appreciate any help.&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Yifan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:30:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711811#M8965</guid>
      <dc:creator>YifanLiu</dc:creator>
      <dc:date>2021-12-12T06:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Add attachment to a feature using Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711812#M8966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yifan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried to set up&amp;nbsp;&lt;STRONG&gt;&lt;SPAN style="color: #000000;"&gt;GenerateGeodatabaseParameters&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;AttachmentSyncDirection &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;to sets the direction for the attachments to be synchronized.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/net/latest/wpf/api-reference//html/P_Esri_ArcGISRuntime_Tasks_Offline_GenerateGeodatabaseParameters_AttachmentSyncDirection.htm" title="https://developers.arcgis.com/net/latest/wpf/api-reference//html/P_Esri_ArcGISRuntime_Tasks_Offline_GenerateGeodatabaseParameters_AttachmentSyncDirection.htm"&gt;GenerateGeodatabaseParameters.AttachmentSyncDirection Property&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Hope that helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Nagma&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Aug 2017 23:07:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711812#M8966</guid>
      <dc:creator>NagmaYasmin</dc:creator>
      <dc:date>2017-08-02T23:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Add attachment to a feature using Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711813#M8967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply Nagma. I am developing for Android and the API is different from WPF. So, unfortunately, your suggestion would not work. Still appreciate it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Aug 2017 23:14:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711813#M8967</guid>
      <dc:creator>YifanLiu</dc:creator>
      <dc:date>2017-08-02T23:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add attachment to a feature using Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711814#M8968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can check for `CanEditAttachments` to know if you're able to add/update/delete attachments for the specified feature. You can also check the result of `ApplyEditsAsync` to know whether any of the edit operation failed.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CanEditAttachments&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;AddAttachmentAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"test.png"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"image/png"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; bytes&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FeatureTable &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; ServiceFeatureTable&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; edits &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; table&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ApplyEditsAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; editResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; edits&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;FirstOrDefault&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; r &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; FeatureEditResult &lt;SPAN class="operator token"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;FeatureEditResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AttachmentResults&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;FirstOrDefault&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ar &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; ar&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CompletedWithErrors &lt;SPAN class="operator token"&gt;||&lt;/SPAN&gt; ar&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Error &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; FeatureEditResult&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your code, is `&lt;CODE&gt;App&lt;SPAN&gt;.&lt;/SPAN&gt;_file&lt;SPAN&gt;.&lt;/SPAN&gt;Name` full file name including path? This should be file name with extension. And the `contentType` parameter should be one of the MIME types that your server support. (i.e. image/png, text/plain, etc.)&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:30:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711814#M8968</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-12T06:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add attachment to a feature using Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711815#M8969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jennifer,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I was missing is in this line:&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt; &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;"&gt;await&lt;/SPAN&gt; feature&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444; border: 0px; font-weight: inherit;"&gt;AddAttachmentAsync&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"test.png"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"image/png"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; bytes&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I put "image/" instead of "image/png", which is what breaks things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Yifan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2017 17:43:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-attachment-to-a-feature-using-xamarin-android/m-p/711815#M8969</guid>
      <dc:creator>YifanLiu</dc:creator>
      <dc:date>2017-08-07T17:43:22Z</dc:date>
    </item>
  </channel>
</rss>

