Add logic when user post a blog post in back-end
So i want to catch an event occurs when a back-end user posts a blog post.
Is there any possible way to do that?
Hello,
You can use the IDataEvent from the EventHub and check for the item type - whether it is a blog item - this will be called on every operation.
Please consult following documentation for additional information:
http://docs.sitefinity.com/for-developers-idataevent
eg.
private
void
Content_Action(IDataEvent @
event
)
var action = @
event
.Action;
var contentType = @
event
.ItemType;
if
(contentType == TypeResolutionService.ResolveType(
"Telerik.Sitefinity.Blogs.Model.BlogPost"
))
// do something
var itemId = @
event
.ItemId;
var providerName = @
event
.ProviderName;
var manager = ManagerBase.GetMappedManager(contentType, providerName);
var item = manager.GetItemOrDefault(contentType, itemId);
I have used the same for accessing & for enhance some of the custom functionality of blogpost, for that I have define some custom fields inside the blogposts so how can I access the data of this custom fields.
Hello Anand,
Once you get the blogpost, you can manage the custom field you need, as described in the sample here:
http://docs.sitefinity.com/for-developers-set-the-value-of-a-custom-field
Regards,
Svetoslav Manchev
Telerik by Progress