Setting ServiceProvider for BlogsManager CRUD

Posted by Community Admin on 03-Aug-2018 21:45

Setting ServiceProvider for BlogsManager CRUD

All Replies

Posted by Community Admin on 10-Mar-2017 00:00

Hello all,

I am trying to query blog posts using CRUD, I have managed to get the basic search done.

The problem that I am facing is that I have multiple service providers for my blogs (I have a custom service provider from here). When I ask for my blogs I only get blogs from the default provider, but I only want blogs from from the custom provider. 


BlogsManager blogsManager = BlogsManager.GetManager();
List<BlogPost> blogPosblogsManagert = blogsManager.GetBlogPosts().Where(b => b.Status == ContentLifecycleStatus.Live).ToList();

I am able to find the provider(s) inside the blog manager, but I don't understand how to set it. (blogsManager.Provider / blogsManager.AllProviders)

Thank you,

Posted by Community Admin on 27-Jun-2017 00:00

For anybody who is looking. I managed to solve this.


var providers = BlogsManager.GetManager().GetContextProviders();
BlogsManager blogManager;
var blogs = new List<Telerik.Sitefinity.Blogs.Model.BlogPost>();
foreach (var provider in providers)
     if (provider.Name == "UrlNameProvider")
         blogManager = BlogsManager.GetManager(provider.Name);
         var tempList = blogManager.GetItems(typeof(Telerik.Sitefinity.Blogs.Model.BlogPost), string.Empty, string.Empty, 0, 0)
             .Where(i => i.Status == ContentLifecycleStatus.Live && i.Visible == true).ToList();


This thread is closed