0

I have customized my page using CSR list form . How to display attachment in the edit and display form?

closed as unclear what you're asking by Robert Lindgren Oct 21 '15 at 11:02

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You're going to have to provide much more detail if you want help with your question. – Submits Oct 21 '15 at 9:56
0

I mostly get all my stuff with REST. Also the Attachment URL.

Check my blogpost here: https://blog.afrait.com/get-attachment-url-from-list-item/

Or take a look at the script below:

<script type="text/javascript">

    $(document).ready(function() {

        // Rest URL
        var requestUri = "/_api/lists/getbytitle('Marketplace')/items?$select=Title,ID,Attachments,AttachmentFiles&$expand=AttachmentFiles";

            $.ajax({
                url: requestUri,
                type: "GET",
                headers: { "ACCEPT": "application/json;odata=verbose" },
                success: function (data) {

                    $.each(data.d.results, function (i, item){
                        var title = item.Title;
                        var id = item.ID;
                        var attachmentUrl = item.AttachmentFiles.results[0];

                        //alert(attachmentUrl.FileName);
                        //alert(attachmentUrl.ServerRelativeUrl);

                    })
                },
                error: function () {
                    alert("Error getting the Marketplace Items");
                }                     
            });
      });      

</script>
  • HI Patrik , Thanks for ur help . I have used similar kind of code and got the output . Do u know how to attach the file in edit and display form . I have customized my page using CSR list form – user48040 Oct 21 '15 at 11:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.