[SharePoint 2010 Developpement] Tips for creating programmatically webpart, which class should you use

You want to create a webpart for SharePoint 2010 but you don’t know which class to use ?
I was using those way :

  • Search on google and find examples
  • Randomly type in Visual studio the webpart name, example : content, and it would propose me the classes ContentByQuery…

image
But there is a more simple way :

  • Create the webpart by interface in SharePoint 2010

image

  • Export the .webpart file from the webpartimage

This will export a .webpart

  • Now edit it with a text editor

image
You could see the full namespace used, and so the ClassName : ContentByQueryWebpart.

Hope that helped,

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: