Hi,
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:
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">async</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">save</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">await</SPAN> feature<SPAN class="punctuation token">.</SPAN><SPAN class="token function">LoadAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// bytes is the byte array containing data of the file</SPAN>
<SPAN class="keyword token">var</SPAN> result <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> feature<SPAN class="punctuation token">.</SPAN><SPAN class="token function">AddAttachmentAsync</SPAN><SPAN class="punctuation token">(</SPAN>App<SPAN class="punctuation token">.</SPAN>_file<SPAN class="punctuation token">.</SPAN>Name<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">@"image/"</SPAN><SPAN class="punctuation token">,</SPAN> bytes<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
ServiceFeatureTable sft <SPAN class="operator token">=</SPAN> feature<SPAN class="punctuation token">.</SPAN>FeatureTable <SPAN class="keyword token">as</SPAN> ServiceFeatureTable<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">await</SPAN> sft<SPAN class="punctuation token">.</SPAN><SPAN class="token function">UpdateFeatureAsync</SPAN><SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">await</SPAN> sft<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ApplyEditsAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>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.
Am I missing any steps here? Appreciate any help.
Best
Yifan