To use the example in this blog, you'll need
A SharePoint 2013 development environment (app isolation required for On-Premises scenario).
Visual Studio 2012 or Visual Studio 2013 with Office Developer Tools for Visual Studio 2012, or Napa (SharePoint Online only).
You'll also need to set full control add-in permissions at the Web scope. Only the users who have sufficient permissions to change the list permissions (such as site owners) can run this add-in.
A SharePoint 2013 development environment (app isolation required for On-Premises scenario).
Visual Studio 2012 or Visual Studio 2013 with Office Developer Tools for Visual Studio 2012, or Napa (SharePoint Online only).
You'll also need to set full control add-in permissions at the Web scope. Only the users who have sufficient permissions to change the list permissions (such as site owners) can run this add-in.
- <script>
- var siteUrl = 'http://gowthamr.SharePoint.com';
- var listTitle = 'Tutorial List';
- var itemid='5';
- $(document).ready( function() {
- getattachmentfiles();
- });
- function getattachmentfiles() {
- $.ajax({
- url: siteUrl+"/_api/web/lists/GetByTitle("+listTitle+")/items(itemid)/AttachmentFiles('file name')/"
- method: GET,
- headers:{
- Authorization: "Bearer " + accessToken
- accept: "application/json;odata=verbose",
- content-type: "application/json;odata=verbose"
- content-length:length of post body},
- success: successHandler(responseData),
- error: errorHandler
- });
- }
- function successHandler(responseData) {
- var attachments=responseData.d.results;
- alert('Request updated Successfully.');
- }
- function errorHandler(xhr, ajaxOptions, thrownError) {
- alert('Request failed: ' + xhr.status + '\n' + thrownError + '\n' + xhr.responseText);
- }
- </script>
Conclusion
Was my blog helpful?
If so, please let me know at the bottom of this page. If not, let me know what was confusing or missing and I will use your feedback to double-check the facts, add info and update this blog.
Was my blog helpful?
If so, please let me know at the bottom of this page. If not, let me know what was confusing or missing and I will use your feedback to double-check the facts, add info and update this blog.

Join the conversation! Your thoughts help the community grow.