This is a migrated thread and some comments may be shown as answers.

different xhr.responsetext in sharepoint 2016 and 2013

3 Answers 118 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Dariusz
Top achievements
Rank 1
Dariusz asked on 23 Jul 2020, 02:11 PM

Hi 😊

I need some help. I was using kendo for uploading files into sharepoint 2013. After migration to sp 2016 the same code generates different response from server (it is without 'd' and it starts with odata.metadata - the old working one has 'd' and __metadata). Is the odata different and that causes issues? Any help would be appreciated. Thanks.

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 27 Jul 2020, 12:39 PM

Hi Dariusz,

We are not experts in Sharepoint so we are not sure what has changed in the way the response is returned from the server. Sharepoint's forums would be a better place for this inquiry.

With regard to the Upload, when you return an empty string from the server this signifies success. If you want to return a message, for example an error message, you can either return a string, e.g.:

return Content("my message");

or if you have some error handling you can return the error message like this:

try
{
    // return an empty string
    return Content(string.Empty);
}
catch (Exception ex)
{
    // return the error message

    return Content(ex.Message);
}

The returned message can be then accessed in the Upload's error event handler:

function onError(e) {
    var error = e.XMLHttpRequest.responseText;
    alert(error);
}

Regards,
Ivan Danchev
Progress Telerik

0
Dariusz
Top achievements
Rank 1
answered on 27 Jul 2020, 03:08 PM

Thanks Ivan.

I found out what it was. For future if someone will face this problem he or she has to add to accept header: odata=verbose.

Thanks again and have a nice day 😊

0
Ivan Danchev
Telerik team
answered on 29 Jul 2020, 02:07 PM

Hi Dariusz,

I am glad to hear you were able to identify what was causing the issue. I am sure it would be helpful, in case someone else from the community stumbles upon this problem. Thank you for posting this information.

Regards,
Ivan Danchev
Progress Telerik

Tags
Upload
Asked by
Dariusz
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Dariusz
Top achievements
Rank 1
Share this question
or