Attachment File using REST was failed to upload with the problem of SP.RequestExecutor.js
-
21-01-2021 - |
解决方案
You have used SP.RequestExecutor which is used for making cross domain calls and if so your _spPageContextInfo.webServerRelativeUrl won't work. Either you need to use query string to get the url or try using hard code url value. For getting url from query string
hostweburl =
decodeURIComponent(
getQueryStringParameter("SPHostUrl")
);
appweburl =
decodeURIComponent(
getQueryStringParameter("SPAppWebUrl")
);
var scriptbase = hostweburl + "/_layouts/15/";
For reference Click here
其他提示
With regards to the error your encountering , I believe you want to change your call to _spPageContextInfo.webServerRelativeUrl
to _spPageContextInfo.siteAbsoluteUrl
The following article provides a good breakdown on the properties available on _spPageContextInfo