Im using sp2010. I have created programmatically a module where I copy my custom itemstyle.xsl. I named it customItemStyle.xsl. How can I programmatically set this customItemStyle.xsl file as default on an existing CQWP?

1 Answer 1


You'd have to update the ItemXslLink on every single one of them - It can be done programmatically, but then you have to run a console job each time an CQWP is inserted on any page anywhere on the site.

The best way secure that CQWPs you insert in the future have your custom ItemStyle.xsl, is by downloading an already inserted CQWP, open it and change it's ItemXslLink property to your own.
Then after you have changed the ItemXslLink, upload the modified CQWP to the Webpart gallery.

Here is a good blog with a simple walkthrough on how to do just that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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