views:

280

answers:

4

I have tried Visual Studio Site Solution generator for building Sharepoint Site solution.

My requirement is to validate blog entries with some criteria at run time. I want to add the same Bad Keyword thing I had asked earlier.

But Visual Studio Site Solution generator is unable to create solution for Blog Site and showing below error

The Solution Generator does not support Site Definition of this type

Advice any other approch if available.

It worked for Discussion Board library and also the Custom Lists using ListDefinition. However, I am not able to do the same on Blog.

+1  A: 

Since Sharepoint is always list based, I can suggest to inspect SPItemEventReceiver.ItemAdded Method

Rubens Farias
I am unable to deploy the code where I have added itemAdded functionaly for the Blog site template.
hemalshah
+1  A: 

As far as I know the Solution Generator makes a "best attempt" but because of the complexities involved, it doesn't always work. I prefer to use a tool such as WSPBuilder instead of VSeWSS for this reason, however it doesn't have functionality like the Solution Generator.

If you're looking for an improved blog engine for SharePoint, why don't you try Community Kit for SharePoint:Enhanced Blog Edition?

Alex Angas
Hey Alex, the problem is that I want to add the same Bad Keyword thing I had asked earlier. It worked for Discussion Board library and also the Custom Lists using ListDefinition.However, I am not able to do the same on Blog.
hemalshah
A: 

Use a custom Workflows and a custom Activity to do whatever it is you need done.?

CptSkippy
I want to keep the site Approval free. I dont even want these items to show up.
hemalshah
@hemalshah : I meant create a custom Workflow with custom Activity.
CptSkippy
+2  A: 

As Rubens Farias states you should use an event receiver, but I'll try and expand on the process.

You should write an event receiver to handle events that occur when you add or update blog entries. A blog site stores posts in a list based on a template named Blog Posts list (with a template ID of 0x0110).

Knowing this, I would:

  • create a new project in Visual Studio (using VSeWSS or WSPBuilder both will work)
  • add a class that implements SPItemEventReceiver (this is the "event receiver")
  • override the ItemAdded, ItemAdding, ItemUpdated and/or ItemUpdating methods with your own implementation. You may not need to use all of these depending on your requirements and you should understand the difference between synchronous and asynchronous events
  • create a feature that registers your event receiver with the Blog Post list template (using the ListTemplateId 301).

To help you find out more about how do to go about the above steps, I recommend reading the following:

dariom
I have done all other things that you mentioed expect adding template ID. Can you please tell me where to update this Template ID and List ID. I am pretty clueless coz i am new to sharepoint development.
hemalshah
Yeah SharePoint has a bit of a learning curve! You'll get the hang of things :) The ListTemplateId is an attribute of the <Receivers> element in the Elements XML (which is in turn referenced by the feature XML file). See the How to: Create an Event Handler Feature link that I posted (Step 4. under the heading "To add the event handler as a Windows SharePoint Services Feature")
dariom
I will have to bang my head for a few days. I hope this will resolve my issue. I would come up with the code if I managed to get this done :)
hemalshah
Just keep asking questions on StackOverflow if you get stuck. Folks are here to help :)
dariom