I have tried Visual Studio Site Solution generator for building Sharepoint Site solution.
My requirement is to validat开发者_如何转开发e 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.
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/orItemUpdating
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:
- Event Fundamentals
- Event Registrations
- How to: Create an Event Handler Feature
Since Sharepoint is always list based, I can suggest to inspect SPItemEventReceiver.ItemAdded Method
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?
Use a custom Workflows and a custom Activity to do whatever it is you need done.?
精彩评论