How can I add attachment in SharePoint I am stuck on this problem hopefully can help me to proceed this problem. I will so much appreciate your help. Thank you.
2 Answers
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
-
Could you please send me the link of the main function on how can I attach file in sharepoint using custom.junreyd– junreyd2018-08-21 08:01:37 +00:00Commented Aug 21, 2018 at 8:01
-
You can refer here docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/…Sunil Sahu– Sunil Sahu2018-08-21 08:24:15 +00:00Commented Aug 21, 2018 at 8:24
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
-
Please specify the function of attachment or the problem on my code.junreyd– junreyd2018-08-21 08:05:47 +00:00Commented Aug 21, 2018 at 8:05

