//- @GetBlogMetaData -// public static BlogMetaData GetBlogMetaData(String blogGuid) { using (BlogClient blogClient = new BlogClient(BlogSection.GetConfigSection().Service.Endpoint.Blog)) { blogClient.ClientCredentials.UserName.UserName = BlogSection.GetConfigSection().Service.Authentication.DefaultUserName; blogClient.ClientCredentials.UserName.Password = BlogSection.GetConfigSection().Service.Authentication.DefaultPassword; //+ return(blogClient.GetBlogMetaData(blogGuid)); } }
//- @GetBlogMetaData -// public static BlogMetaData GetBlogMetaData(String blogGuid) { using (BlogClient blogClient = new BlogClient(MinimaConfiguration.ActiveBlogServiceEndpoint)) { blogClient.ClientCredentials.UserName.UserName = MinimaConfiguration.DefaultServiceUserName; blogClient.ClientCredentials.UserName.Password = MinimaConfiguration.DefaultServicePassword; //+ return(blogClient.GetBlogMetaData(blogGuid)); } }
//- @GetRssFeed -// public Rss20FeedFormatter GetRssFeed(String blogGuid, String maxCount) { Int32 maxCountInt32; if (!Int32.TryParse(maxCount, out maxCountInt32)) { return(null); } using (BlogClient blogClient = new BlogClient(BlogSection.GetConfigSection().Service.Endpoint.Blog)) { blogClient.ClientCredentials.UserName.UserName = BlogSection.GetConfigSection().Service.Authentication.DefaultUserName; blogClient.ClientCredentials.UserName.Password = BlogSection.GetConfigSection().Service.Authentication.DefaultPassword; List <BlogEntry> blogEntryList = null; try { blogEntryList = blogClient.GetBlogEntryList(blogGuid, maxCountInt32, true, false, BlogEntryRetreivalType.MetaDataOnly); } catch (FaultException <ArgumentException> ) { return(null); } catch (FaultException <SecurityException> ) { return(null); } catch { return(null); } if (blogEntryList.Count == 0) { return(null); } BlogMetaData blogMetaData = blogClient.GetBlogMetaData(blogGuid); //+ blog SyndicationFeed syndicationFeed = new SyndicationFeed(); syndicationFeed.Description = new TextSyndicationContent(blogMetaData.Description); foreach (Label label in blogMetaData.LabelList) { syndicationFeed.Categories.Add(new SyndicationCategory(label.Title)); } //+ blog entry list List <SyndicationItem> itemList = new List <SyndicationItem>(); foreach (BlogEntry blogEntry in blogEntryList) { SyndicationItem syndicationItem = new SyndicationItem { Title = new TextSyndicationContent(blogEntry.Title), Summary = new TextSyndicationContent(blogEntry.Content), PublishDate = new DateTimeOffset(blogEntry.PostDateTime), }; syndicationItem.Links.Add(new SyndicationLink(new Uri(Themelia.Web.Http.Root + "/" + Themelia.Web.UrlCleaner.FixWebPathHead(blogEntry.MappingNameList.First())))); foreach (Author author in blogEntry.AuthorList) { syndicationItem.Authors.Add(new SyndicationPerson(author.Email)); } foreach (Label label in blogEntry.LabelList) { syndicationItem.Categories.Add(new SyndicationCategory(label.Title)); } //+ itemList.Add(syndicationItem); } syndicationFeed.Items = itemList; //+ return(new Rss20FeedFormatter(syndicationFeed)); } }