Document Library Preview Web Part Not Uploading

Copper Contributor

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

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?!

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();
}

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();
}

Also having this issue, but we need the upload feature, we don't want to hide it. MS Article says the web part can upload files, is this a function available to "Targeted Release" only or is it a settings thing?

 

Hoping someone from MS can help answer?

 

https://support.office.com/en-us/article/use-the-document-library-web-part-a9dfecc3-2050-4528-9f00-2...

 

 

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.

 

This did not work for me.

Upload works fine for me.

Although the Replace existing file function does not.
Error:

Error at Replace existing file when Upload in Document library web part (Preview).png

 

 

Supposedly fixed when web part is GA.

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