Skip to main content

I am using Office 365 and nintex forms and trying to get list item attachments in task forms. As the attachments doesn't come by default i am using javascript ajax call to get the attachment url but the ajax call is throwing Forbidden error.

 

In the developer tool i observed the error as -- required Cross Origin Resource Sharing (CORS). Here is my ajax call code. This code worked fine when i called in script editor web part.

 

NWF$.ajax({
              url: requestUri,
              type: "GET",
              dataType : "json",
              crossDomain: true,
              xhrFields: {                  withCredentials: true
              },
              headers: {
                  "accept":"application/json; odata=verbose"
              },
              success: onSuccess,
              error: onError
});

 

Please Let me know how can i resolve the issue.

Try using a REST Call to your_sharepoint_site/_api/web/lists/getbytitle('Your list name')/items(item_ID)/AttachmentFiles


In my ajax call "requesturi" is the rest call only. it is the same url as you mentioned. when i browse the url in sharepoint site it is working but not in nintex form.


Reply