Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

SharePoint Development Just Got Simpler Thanks to Visual Studio Extensions : Page 2

If you were hoping for some new widgets to make repetitive development tasks simpler in Sharepoint, the new 3.0 version did not disappoint. With the new Visual Studio 2005 Extensions things like creating list and site definitions no longer have to be done from scratch.


advertisement
Easy List Definitions
If you've ever tried to create your own list definition you know that there is a similarly mundane list of things that you must do before you can start working on the list definition itself. If they were just complex that would be bad enough, but list definitions must also conform to CAML structure, making mastery of list definitions a rare skill indeed. But things are changing: WSS introduced an XSD (XML Schema Definition) that validates the CAML automatically. VSeWSS builds on this by can create a working template of your list definition for you. Thus, today list definitions are within the reach of every SharePoint developer.

Let's walk though the steps. After selecting your list definition's project type you're presented with a List Definition Settings dialog (see Figure 2). This dialog presents you with the basic range of list definitions from which you'll select one to be the template for your new list definition. You can also create an instance of the list and an event receiver.

The event receiver option actually creates two event receiver classes. The first is an item event receiver that receives events fired based on additions, deletions, and changes. The other event receiver is a list event receiver, which is fired when fields are added or removed from the list. Figure 3 shows the list schema and a part of the project file created for you automatically.




Figure 2. Pick the right list type to base your new list from.
 
Figure 3. Thousands of lines of code are already in your list definition for you.

In addition, getting your list set up the way you want it is easier, thanks to formerly hard-to-find properties being added automatically. If you right-click on the project, select properties and then select the bottom item, SharePoint Solution, the available properties for the project are exposed on the left (see Figure 4). You can also set or reset Guids and turn visibility of the list definition on and off.

Figure 4. The SharePoint Solution Section conveniently displays the project's various properties.
The magic of VSeWSS is that all of the work necessary to deploy and use the new list definition is done for you when you build. Behind the scenes VSeWSS is creating a solution that deploys your event receiver (if you selected one), installs the list definition feature to SharePoint, activates the features for the list definition, and creates an instance of the list definition.

In my testing of this current version I encountered a bug that doesn't properly register the event receivers against the list definition—if you selected that option. This bug has not yet been confirmed by Microsoft, so until further notice don't expect your event receivers to deploy without issue.

All in all there's a lot of work going on behind the scenes—instead of on your desktop—to create a working environment for developing and testing list definitions.

Easy Site Definitions
Something that should be a reoccurring theme by now is that VSeWSS makes the process of developing for SharePoint very easy. Site definitions are no exception to this rule. When you create a site definition you get not only the core ONET.XML and default.aspx files that you'll need but a site provisioning handler that lets you run code on your new site definition every time it is created. This is a pretty handy thing since the CAML in the ONET.XML file can't possibly handle everything that you may want to do when the site is started up.

As with the other project types that VSeWSS adds, using your new project is as simple as pressing F5. The site definition will be deployed and associated so that you can use it immediately. When you go to the New SharePoint Site page to create a site there will be a development tab that you can use to create a site from your new site definition.

The true power of site definitions isn't really the ability to create a new site definition from scratch. The power exists in a standalone tool "SharePoint Solution Generator," which promises to create a site definition from an existing site. In the next section, I'll have a look at this new feature in detail.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap