Hello,
I need to send a file from my widget to SharePoint site on button click. First I tried to connect to SHP via SHP REST API. In my function I have this code get from Complete basic operations using SharePoint 2013 REST endpoints :
<SPAN class="keyword token">var</SPAN> appweburl <SPAN class="operator token">=</SPAN> <SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fserver.domain.cz%2F" target="_blank">https://server.domain.cz/</A><SPAN>"</SPAN></SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> executor <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">SP<SPAN class="punctuation token">.</SPAN>RequestExecutor</SPAN><SPAN class="punctuation token">(</SPAN>appweburl<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
executor<SPAN class="punctuation token">.</SPAN><SPAN class="token function">executeAsync</SPAN><SPAN class="punctuation token">(</SPAN>
<SPAN class="punctuation token">{</SPAN>
url<SPAN class="punctuation token">:</SPAN>
appweburl <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"/_api/SP.AppContextSite(@target)/web/lists?@target='"</SPAN> <SPAN class="operator token">+</SPAN>
hostweburl <SPAN class="operator token">+</SPAN> <SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">,</SPAN>
method<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"GET"</SPAN><SPAN class="punctuation token">,</SPAN>
success<SPAN class="punctuation token">:</SPAN> successHandler<SPAN class="punctuation token">,</SPAN>
error<SPAN class="punctuation token">:</SPAN> errorHandler
<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></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>