Forum Discussion

Rod Merritt's avatar
Rod Merritt
Copper Contributor
Mar 26, 2018

Document Library Preview Web Part Not Uploading

I am no longer able to upload files with the Document Library Preview web part. Anyone else having this issue. I know it's in preview but if I can't upload can I at least hide the upload button?

7 Replies

  • Eric_Mases's avatar
    Eric_Mases
    Copper Contributor

    Upload works fine for me.

    Although the Replace existing file function does not.
    Error:

     

     

    Supposedly fixed when web part is GA.

    Or users need to goto Library and upload for Replace to work.

    • Ian Moran's avatar
      Ian Moran
      Steel Contributor

      Seeing the same, indeed was about to post. What you can do is select the Document Library in the navigation and upload there, for now.

       

  • Lee Curtis's avatar
    Lee Curtis
    Copper Contributor

    Yes, I have this issue too. Even for something in preview, not being able to upload to a document library is pretty basic. Does Microsoft want us to use this new experience?!

    • Rod Merritt's avatar
      Rod Merritt
      Copper Contributor

      I ended up creating an Application Customizers extension. Use the code below on the public OnInit method to inject CSS to change the link color and hide the upload toolbar. I needed the link color white on my dark theme.

       

      @override
      public onInit(): Promise<void> {
      // Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);

      // let message: string = this.properties.testMessage;
      // if (!message) {
      // message = '(No properties were provided.)';
      // }

      // Dialog.alert(`Hello from ${strings.Title}:\n\n${message}`); 

      (() => {
      /** hack styles for the document library preview links and hide upload toolbar */
      const style1 = document.createElement('style');
      style1.innerText = `
      .detailsListCellName a.ms-Link {
      color: #fff;
      }
      .ms-CommandBar {
      display:none;
      }
      `;
      style1.setAttribute('target', 'pagination');
      document.head.appendChild(style1);
      })();
      return Promise.resolve();
      }

      • Rod Merritt's avatar
        Rod Merritt
        Copper Contributor

        Updated code to work in IE and Chrome

         

        @override
        public onInit(): Promise<void> {
        // Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);

        // let message: string = this.properties.testMessage;
        // if (!message) {
        // message = '(No properties were provided.)';
        // }

        // Dialog.alert(`Hello from ${strings.Title}:\n\n${message}`);

        // (() => {
        // /** hack styles for the pagination buttons */
        // const style1 = document.createElement('style');
        // style1.innerText = `
        // .detailsListCellName a.ms-Link {
        // color: #fff !important;
        // }
        // .ms-Link {
        // color:#fff !important;
        // }
        // .ms-CommandBar {
        // display:none !important;
        // }
        // `;
        // style1.setAttribute('target', 'pagination');
        // document.head.appendChild(style1);
        // })();

        var sheet = document.createElement('style');
        sheet.innerHTML = `
        .detailsListCellName a.ms-Link {
        color: #fff !important;
        }
        .ms-Link {
        color:#fff !important;
        }
        .ms-CommandBar {
        display:none !important;
        }`;
        document.body.appendChild(sheet); // append in body
        //document.head.appendChild(sheet); // append in head

        return Promise.resolve();
        }

Resources