locked
Please provide code example for overwriting the CSS file : xyz.css to http://abcd.com/_layouts/15/PQR/styles/xyz.css when the feature is activated. RRS feed

  • Question

  • Hi,

    In SharePoint 2016, I have created a Sharepoint solution having a custom feature with a event receiver which has to overwrite a CSS file : xyz.css to http://abcd.com/_layouts/15/PQR/styles/xyz.css when the feature is activated.
     
    Please provide code example for overwriting the CSS file : xyz.css to http://abcd.com/_layouts/15/PQR/styles/xyz.css when the feature is activated.

    Thanks in advance.

    • Edited by Jack63_01 Monday, April 29, 2019 1:49 PM
    Monday, April 29, 2019 1:46 PM

All replies

  • Hi

    Do you use Visual Studio to develop the solution?

    You can add a mapped Layouts folder and put your file in it.

    But it cannot be controlled by feature.


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Tuesday, April 30, 2019 1:41 AM
  • Hi,

    Here is a workaround for your reference.

    Create a custom master page, reference the ‘_layouts/15/PQR/styles/xyz.css’ in this custom master page, then, update SharePoint master page in event receiver of feature.

    https://www.c-sharpcorner.com/blogs/set-custom-master-page-in-sharepoint-using-event-receiver1

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Proposed as answer by Dennis Guo Monday, May 6, 2019 7:10 AM
    Tuesday, April 30, 2019 1:51 AM