4

I have observed that while inside a document library we can provide descriptions to columns, which shows up under the input next to the specific field. But as 'Name' column is a system column in SharePoint 2013 online, how can i provide description to it? Any help would be much appreciated.

6

Name column is from Document content type. It is not editable from browser or designer. enter image description here

See there is no link in the Name column. You will find the same thing in the SharePoint Designer also.

Interestingly, It is editable from custom code (C#, JavaScript and PowerShell).

JavaScript Example

function addOrUpdateDescriptionOfColumn(libraryName, columnName, description) {
    var context = new SP.ClientContext.get_current();
    var web = context.get_web();
    var list = web.get_lists().getByTitle(libraryName);
    var fields = list.get_fields();
    var theField = fields.getByInternalNameOrTitle(columnName);

    theField.set_description(description);
    theField.update();
    context.load(theField);
    context.executeQueryAsync(onSuccess, onError);


    function onSuccess() {
        alert("Description updated successfully");
    }

    function onError(sender, args) {
        alert(args.get_message());
    }
}

PS: FileLeafRef is the in the internal name of the Name column.You can use your browser's console to add/update the description of a column.

  1. Login your site where your list/library exists
  2. Open developer tool (Press F12) and go to console
  3. Paste above function and press Enter
  4. The call addOrUpdateDescriptionOfColumn() function with parameters. For example, addOrUpdateDescriptionOfColumn("MAST", "FileLeafRef", " Please follow the required naming convention.");

Result

After applying above code you should get following result. enter image description here

  • Thank you Atish! Do i have to insert the above JavaScript code into a web part like script editor which will be added into my document library? Also will I have to add any reference to my script editor like jquery? So that this function works. – mohd tahir Aug 2 '16 at 12:57
  • No no. Just execute above function in your browser's console. That's it. Can you give your list/library name, column name and description so that I can write the full code for you. – Atish Dipongkor - MVP Aug 2 '16 at 12:59
  • library name :- MAST , column name :- Name , description :- Please follow the required naming convention. – mohd tahir Aug 2 '16 at 13:02
  • And Atish i have one more question in this case will my client too executing this code in his/her browsers console every time, just to apply these changes? – mohd tahir Aug 2 '16 at 13:03
  • 1
    Copy all code from here jsbin.com/jukiqitoto/edit?js and paste in console and then press enter. Finally check in the browser. Let me know what happens after applying these code. – Atish Dipongkor - MVP Aug 2 '16 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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