I'd like to take an existing web part and add some functionality. Can this be done? I figured out how to download the dwp for the webpart but this does not appear to have any source code in it.


As noted in my comment below, my end goal is to create a page that will be able to search only on columns specific to the content type selected. If someone has suggestions on how to approach this, please let me know.

  • 1
    Can you provide us name of the webpart, and more information on how do you want to extend it? Commented Apr 8, 2011 at 17:07
  • I wanted to use the Advanced Search Webpart as a base and add some fielded search capabilities. If you know of anything opens ource out there please let me know. I looked around a bit but didn't find anything. Commented Apr 8, 2011 at 18:09

4 Answers 4


You can certainly do this for Content Query Web Parts, but beware that some web parts might be sealed.

If you use ILSpy you can view the SharePoint Assemblies to gain understanding of how the OOTB web parts work.

Here's a link to ILSpy: http://wiki.sharpdevelop.net/ilspy.ashx

Here's a link to Andrew Connell's blogpost on extending the Content Query Web Part, as an example: http://www.andrewconnell.com/blog/archive/2008/02/18/Subclassing-the-Content-Query-Web-Part-Adding-Dynamic-Filtering.aspx

  • 2
    Your rep is so low James! Commented Apr 8, 2011 at 17:08
  • 1
    Tell me about it :(
    – James Love
    Commented Apr 8, 2011 at 17:11
  • 1
    +1, i didnt know that reflector was now a paid product and ilspy is its replacement
    – djeeg
    Commented Apr 9, 2011 at 9:36
  • 1
    @djeeg Ilspy is one replacement. JetBrains are bringing out a free product called dotPeek but I don't think it's open source.
    – Alex Angas
    Commented May 14, 2011 at 1:16

.dwp and .webpart files contains only definitions of webparts: assembly, class, title, etc. Actual webpart code is in the Microsoft.SharePoint and Mirosoft.Office.Servers assemblies.

  • Can you edit this and explain how to view them? Thank you for helping the newbies out. Commented Nov 3, 2011 at 9:45

So, to extend a webpart, you may be looking at extending the actual class. For this you want to inherit the webpart as a base class.

You can use Reflector to view the source code if you like, though, if possible you should inherit to extend not, just copy&paste code. This allows you to benefit from Microsoft's bug fixes.

EDIT: May 10, 2011

Use ILSpy per James' post now that Reflector costs $$$


Firstly look for the page/webpart/class you are interested in and work out which assembly it is coming from, you can then use a dissasembler tool (like .Net Reflector or ILSpy) to work out what the code is.

In some cases MS will obfuscate the code so you cannot do this, but in most cases it is a really useful way of seeing how MS does something and hence how you can architect a similar or related solution.

  • FWIW: ILSpy has a damned good stab at looking at obfuscated code, though you'll probably see lots of goto statements.
    – James Love
    Commented Apr 8, 2011 at 20:40

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.