Forum Discussion

Nigel_Price9911's avatar
Nigel_Price9911
Iron Contributor
Feb 08, 2018
Solved

Modern Document Library does not allow any text explaing what the document library is for.

Hi

 

I have a document library which opens in the Modern UI.

 

I cannot for the life of me find how to add some text to explain what the document library is for.  I cannot edit the page so cannot add a Text Box.

 

Is there another way of kicking the page into edit mode ?

 

Is there a way of adding text to the document library explaining what the document library is all about?

 

Thanks

 

Nigel

  • Anonymous's avatar
    Anonymous
    Feb 08, 2018
    Create a word file, or Txt file in notepad, with the description, save the file name as Library Description or something similar. Upload it to your library. Once there, select the file and on the top menu is Pin on top button or something similar to that.

13 Replies

  • Ryan Healy's avatar
    Ryan Healy
    Brass Contributor
    A simple SPFX app extension could provide this. Using the placeholders, or the message at, or even a modal from a command bar button, you could show the library description. What would be preferable?
    • Nigel_Price9911's avatar
      Nigel_Price9911
      Iron Contributor

      Hi Ryan

       

      I am always interested in SPFx solutions.

       

      I know about using SPFx Extensions to add headers and footers to site.

       

      But using SPFX extensions to add instructions to a Document Library ?

       

      Can you tell me more ?

       

      Thanks

       

      Nigel

      • Ryan Healy's avatar
        Ryan Healy
        Brass Contributor

        Build an application extension as per the tutorial https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/build-a-hello-world-extension

        Install sp-pnpjs and include this import line 

        import pnp from "sp-pnp-js";
        Replace the class content as follows
         
        /** A Custom Action which can be run during execution of a Client Side Application */
        export default class ListPropertiesApplicationCustomizer
          extends BaseApplicationCustomizer<IListPropertiesApplicationCustomizerProperties> {
          @override
          public onInit(): Promise<void> {
            this.getList();
            return Promise.resolve();
          }
          public getList(): Promise<void> {
            //get the ID of the list from the page context
            const listId: Guid = this.context.pageContext.list.id;
            console.log(listId);
           
              pnp.sp.web.lists.getById(listId.toString()).get().then(r => {
                // the list object properties are all returned as per the object model
                console.log(r.Description);
                //Find the list title element using native typescript 
                var parent = document.getElementsByClassName("StandaloneList-title");
                //create a new div
                var newDiv = document.createElement('div');
                //style the new div as you wish
                newDiv.setAttribute("style", "color:red; border-bottom: 1px solid blue; font-size:14px; ");
                // add the decription content
                newDiv.textContent = r.Description;
                //append to the document under the list title
                parent[0].appendChild(newDiv)
              });   
            return Promise.resolve();
          }
        }
         

        The styling and the placement is up to you. I chose the List/Library title but I believe this area also houses any breadcrumb content when you navigate down folders. I haven't tested how well this works.

        Let me know what you think.

        Thanks

        Ryan

         

  • Dean_Gross's avatar
    Dean_Gross
    Silver Contributor
    For reasons that only someone at Microsoft can explain, text entered into the Document Library description attribute no longer shows up in the UI. Hopefully, this will be fixed soon.

    Chris McNulty
  • Anonymous's avatar
    Anonymous
    Nope, you can't edit the default view pages in Modern UI yet. You can always link to a site page, then add a Documents webpart to it and add the text webpart above etc. However that Web Part doesn't function the same as the regular Documents default view so you might have to see if it would work for you.

    Outside of that, and or just linking to a Page before you get to the library, that's about the only option that I know of that you currently have when using modern UI. You can always set the library to classic and then edit the views there as well if Classic meets requirements of the library, but then you don't get the nice Sharing buttons etc.
    • Nigel_Price9911's avatar
      Nigel_Price9911
      Iron Contributor

      Thanks Deleted for getting me so quickly.

       

      The customer does not like the idea of having a page with the explanation which then links to the document library as a number of their users will be accessing by mobile phone, so they want to keep the number of clicks down to a minimum.  In the Modern UI you can by filter by one or more fields easily using the filter pane.  It is not so easy in Classic UI.

       

      I wonder if I can put the document library into a Tab and have the first tab for the  explanation and the second tab for the document library.?

       

      Regards

       

      Nigel

Resources