This blog is moved to
http://amalhashim.wordpress.com

Friday, October 22, 2010

MOSS | Using WSPBuilder for Creating a List Instance

In this post I am going to explain how we can make use of WSPBuilder for creating a List instance.
First we need to install SharePoint Solution Generator. You can download the same from here
http://download.microsoft.com/download/4/0/b/40b62080-6295-4d63-b396-d779fb9b4449/VSeWSSv12.exe
Now follow the steps for generating List Definition. Here I am going to create a List Definition of a List named “Configurations”
Start SharePoint solution generator
image
Select List Definition and click on Next button
image
Specify the Site Url where the list is present and click Next
image
Select the List and click Next
image
Provide a project name and path, then click Next
image
Click Finish
 image
Before clicking Exit, click “Click here to open the generated solution” and click Exit
image
You can see the “Configurations” folder. Let it be opened. Now open visual studio and create a WSPBuilder project
image
Once the project is created, add a new blank feature
image
Now, copy the folder “Configurations” and paste it under the feature folder as shown below
image
Open the ListDefinition.xml file and copy the following content
image
Once the content is copied, paste it in the elements.xml file as shown below and delete the file "ListDefinition.xml" from visual studion project
image
You can also see ListInstance, make a similar entry in your elements.xml file. Also replace the FeatureId with the FeatureId specified in the feature.xml file
Now build the wsp, deploy it and activate the feature. This will add the list to the site.
Hope this was helpful!!!

4 comments:

Khushi said...

Hey Hashmi, If the solution is creating multiple List template, would there be only one Feature.xml and Element.xml?

Why are you deleting ListDefinition.xml? and copying it in element.xml? Why did you combined ListInstance in the same file? Sorry to say but Your article is not giving proper information and is misleading. I wasted my many hours in trying to implement your article.

A.m.a.L Hashim said...

@Khushi: The articles/code I am posting here is well tested. So I am 100% sure it works.

To answer you 1st question, For multiple list templates, create mulitple wsp's and hence different feature/element files.

Second here i am created list template/definition using elements file. That is the reason I am deleting definition file.

And pleasd address me HASHIM not hashmi.

Thanks
Amal

Khushi said...

I am really Sorry about the name Hashim!! Thank you for your response. Could you please tell me How do i modify this solution to define multiple List templates in a Single WSP? My requirement is to make a single WSP to deploy.

Thanks,
Khushi

A.m.a.L Hashim said...

@Khusi, I have tried to do the same technique using single wsp. But for some reason that not worked. I will try to find a solution, meanwhile if you got success please post it here.

Regards,
Amal