Click here to Skip to main content
15,891,607 members
Articles / Programming Languages / Visual Basic

RSS Feed Aggregator and Blogging Smart Client

Rate me:
Please Sign up or sign in to vote.
4.91/5 (85 votes)
16 Aug 2005CPOL52 min read 1.1M   2.4K   397  
RSS Feed aggregator and blogging Smart Client which uses Enterprise Library, Updater Application Block, lots of XML hacks and desktop tricks. A comprehensive guide to real life hurdles of Smart Client development.
using System;

namespace RSSBlogAPI
{
	using CommunityServer;

	/// <summary>
	/// Blog API for Community Server
	/// </summary>
	public class CommunityServerAPI : BlogAPIBase
	{
		public override bool HasCategories
		{
			get { return true; }
		}
		
		public override bool HasBlogId
		{
			get { return false; }
		}

		public override string EngineName
		{
			get { return ".TEXT SimpleBlogService"; }
		}

		public override string HelpText
		{
			get { return ".Text Blog sites"; }
		}

		public override void Test()
		{
			this.GetCategories();
		}

		/// <summary>
		/// Retrieve categories by calling the SimpleBlogService webservice
		/// </summary>
		/// <returns></returns>
		public override Category [] GetCategories()
		{
			string [] categories = this.GetService().GetPostCategories( );

			Category [] output = new Category [ categories.Length ];

			for( int i=0; i<categories.Length; i++ )
				output[i] = new Category( 0, string.Empty, categories[i] );

			return output;
		}

		private BlogService GetService()
		{
			BlogCredentials credentials = new BlogCredentials();
			credentials.Blogname = this.BlogId;
			credentials.Password = this.Password;
			credentials.Username = this.Username;

			BlogService svc = new BlogService();
			svc.Url = this.Url;
			svc.Proxy = this.ProxyServer;
			svc.BlogCredentialsValue = credentials;

			return svc;
		}

		/// <summary>
		/// Post a blog entry by calling simple blog service
		/// </summary>
		/// <param name="post"></param>
		/// <returns></returns>
		public override string PostItem( Post log ) 
		{
			string [] cats = new string[ log.Categories.Length ];
			for( int i=0; i<log.Categories.Length; i++ )
				cats[i] = log.Categories[i].Title;

			BlogPost post = new BlogPost();
			
			post.Body = log.Text;
			post.Categories = cats;
			post.Date = log.Date;
			post.DisplayOnHome = true;
			post.EnableComments = true;
			post.EnableRatings = true;
			post.EnableTrackbacks = true;
			post.Excerpt = post.Title;
			post.IsPublished = true;
			post.ModerateComments = true;
			post.Name = this.Username;
			post.SydicateRoot = true;
			post.Syndicate = true;
			post.Title = log.Title;
			
			return this.GetService().Create( post ).ToString();
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect BT, UK (ex British Telecom)
United Kingdom United Kingdom

Comments and Discussions