Firstly, I'm very new to SharePoint, just the 6th day working with this powerful tool. The problem I'm facing which I can't solve is how to edit for example existing attachment column for list for your own needs. For example I want to make that attachment column instead of showing a paperclip would show attached files to items in that list. I found some tutorials how to make it, i.e. http://amitphule.blogspot.in/2012/04/display-item-attachments-in-sharepoint.html

but this doesn't help. I'm stuck on this part, because in my SharePoint Designer 2013 I don't see same options like here:


Moreover, it seems it doesn't update the list with new attachments.

Similar way of editing columns would be great. BUT is there any other solutions using Visual Studio? I found out that you can create custom content types, new columns BUT I don't want to create new list, I want to edit my current lists' certain columns. How to do that? Any help?

2 Answers 2


There are two ways of showing the attachments of List Item in the same grid where List Items will be shown. Check the followings: enter image description here enter image description here This TestList, each one contains multiple attachments.
Way 1: Using JavaScript-->

var my = my || {}; //my namespace
var context = SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists();
//Get List Name
var ListName = "TestList";

$(document).ready(function () {
    my.ListItem = function(){
        this.ID = ko.observable();
        this.Title = ko.observable();
        this.Attachments = ko.observableArray([]);
    my.Attachment = function () {
        this.AttachmentName = ko.observable();
        this.AttachmentURL = ko.observable();
    my.vm = function () {
            ListItems = ko.observableArray([]),
            RetrieveItems = function(){
                var targetList = list.getByTitle(ListName);
                var camlQuery = new SP.CamlQuery();
                var itemColl = targetList.getItems(camlQuery);
                    var listItemEnumerator = itemColl.getEnumerator();
                    while (listItemEnumerator.moveNext()) {
                        var oListItem = listItemEnumerator.get_current();
                        var tmpID = oListItem.get_item('ID');
                        var tmpTitle = oListItem.get_item('Title');
                        var item = new my.ListItem()
                }, RetrieveItemsFail)
GetAttachemtns = function(tmpID,tmpItem){
                var targetList = list.getByTitle("TestList");
                var targetListItem = targetList.getItemById(tmpID);
                    var item = targetListItem;
                    var total = item.get_attachmentFiles().get_count();
                    for(var count = 0; count < total; count++) {
                        var spfile = item.get_attachmentFiles().get_item(count);
                        var fileName = spfile.get_fileName();
                        var serverRelativeUrl = spfile.get_serverRelativeUrl();
                        tmpItem.Attachments.push(new my.Attachment()
            RetrieveItemsFail = function(){
                alert('Failed to get list items. Error:' + args.get_message());
        return {
            ListItems: ListItems,
            RetrieveItems: RetrieveItems
  • Create a Site Page and add a Content Editor Web Part there and add the following code:

<script src="/<SiteURL>/_layouts/15/SP.Runtime.js" type="text/javascript"></script>
<script src="/<SiteURL>/_layouts/15/SP.js" type="text/javascript"></script>
<script src="/<SiteURL>/SiteAssets/Scripts/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="/<SiteURL>/SiteAssets/Scripts/knockout-3.0.0.js" type="text/javascript"></script>
<script src="/<SiteURL>/SiteAssets/Scripts/Script.js" type="text/javascript"></script>

<table border='1' data-bind="foreach: ListItems" >
                <table data-bind="foreach: Attachments" >
                        <td><a data-bind="attr: { href: AttachmentURL },text : AttachmentName"></a></td>
            <td data-bind="text: ID"></td>
            <td data-bind="text: Title"></td>
  • Save the Page the result will be shown as below:
    enter image description here

Way 2: Using Server Side Code-->

 using (SPSite site = new SPSite(SPContext.Current.Site.ID))
                    using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
                        SPList list = web.Lists["TestList"];
                        SPListItemCollection items = list.Items;
                        foreach (SPListItem item in items)
                            string s = "";
                            foreach (var atchmnt in item.Attachments)
                                string s1 = atchmnt.ToString();

I will suggest you to use JavaScript instead of Server Side Code. Best of Luck !!!

  • Hi, I still have some questions and problems. Firstly, I can't download knockout, it just opens in new tab the whole source code. Sadly, I don't have any tools for saving .js files. Can you upload it? Moreover, if I would choose the second way, how would I execute server side code? I have a lot samples using similar code, but never figured out how to execute them and where? Still, will try to solve these by myself, but your answers still would be great. Jul 19, 2014 at 17:33
  • You can directly press ctrl + s save it from the browser and save it as knockout.js. Now for the second one you need to create a visual web part. check the following link where the procedure of creating a visual web part is depicted:msdn.microsoft.com/en-us/library/ff597539(v=office.14).aspx Jul 21, 2014 at 9:56
  • deployed both your suggested ways, both doesn't work. JavaSricpt way just diplays some litle boxes with no info and the second way ruin the page, I get an error loading the page after web part deployment. Jul 23, 2014 at 8:02
  • Regarding the first: The script might not be referred correctly. Can you please open the site in Chrome and Press F12 and check the errors in Console. It is working for me. And Regarding the Second One: Can please create a simple Visual Web part and deploy it and test it first and after that if it is ok then put my code. It should work. Jul 23, 2014 at 10:42
  • Opened it with various browsers, always the same. What about Visual Web Parts. I have been adding some very simple web parts with buttons and etc. and all Works good. So with deployment I'm okay. Maybe I'm imputing code wrongly? I'm adding it to WebPartName.cs file before CreateChildControls function. Jul 23, 2014 at 11:38

The design view was removed from SPD2013, so that is why you do not see the options to edit the view.

The suggested method in SP2013 is to use JSLink to change the column. A couple of references:

Martin Hatch: http://www.martinhatch.com/2013/08/jslink-and-display-templates-part-1.html

Chris O'Brien: http://www.sharepointnutsandbolts.com/2013/01/using-jslink-to-change-ui-of-sharepoint_20.html

  • Well, im not familiar with JavaScript and I dont have suchs needs as changing the design of columns. Any solutions using C# ? Jul 17, 2014 at 7:18
  • I need to change functionality of the column, for example that it would show attachments' names instead of paperclip. Jul 17, 2014 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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