Goal To grab the URL of a blog post from a specific blog when it has been published.
Hello, I am new to Sitefinity and have searched Google and the forums and can't quite find a good example or information on what I need to know.
The closest things I've found so far:
So first question. For my needs, which route should I go between IDataEvent and IDynamicContentUpdatedEvent?
Second. Should I be subscribed to Updated or Created? I would assume Created only fires once and does not fire again when the post is published (no posts would be created in a published state). If Updated, I can tell if the post is published by checking its status or IsPublished. But how would I differentiate between an update to publish a post and an update to an already published post? I would only want to run the code once when the post is initially published.
Third. Assuming that the item is of type BlogPost, How can I tell what Blog it belongs to? For example, under Blogs there is Blog1 and Blog2. Would I get this from BlogPost.Parent.Title?
Fourth. Does BlogPost.ItemDefaultUrl return the canonical url of the post? Is it also full path or just relative?
I'm currently trying the IDataEvent route but am hitting a roadblock. Here is the gist so far. I'm also still not seeing a way to determine the answer to question 2.
var action = @
var contentType = @
var itemId = @
var providerName = @
var manager = ManagerBase.GetMappedManager(contentType, providerName);
var item = manager.GetItemOrDefault(contentType, itemId);
var blogType = TypeResolutionService.ResolveType(
(item.GetType().FullName == blogType.FullName && action.ToLower() ==
//Blog post that has been updated
//Working up to this point
//BlogPost post = (BlogPost)item; //Doesn't seem to work
BlogsManager blogManager = BlogsManager.GetManager();
BlogPost post = blogManager.GetBlogPost(itemId);
//This doesn't seem to work either
//Not getting in here
(post.Status == ContentLifecycleStatus.Live && post.Parent.Title.ToLower() ==
//blog1 post that is published
url = post.ItemDefaultUrl;
(WebClient client =
var parm =