sBlogs = @"<?xml version=""1.0"" encoding=""utf-8"" ?>";
sBlogs += @"<BlogPosts>";
SPListItemCollection docList = list.GetItems(docQuery);
foreach (SPListItem item in docList)
{
DateTime PublishedDate = DateTime.Parse(item["PublishedDate"].ToString());
if (PostDate != PublishedDate.ToString("MMMM yyyy"))
{
//Make sure not first time through loop
if (PostDate != string.Empty)
{
sBlogs += @"</PostMonth>";
}
PostDate = PublishedDate.ToString("MMMM yyyy");
sBlogs += @"<PostMonth name=""" + PostDate + @""">";
}
sBlogs += @"<PostName name=""" + item["LinkTitle"].ToString() + @""" url=""" + sUrl + @"/Lists/Posts/Post.aspx?ID=" + item.ID.ToString() + @"""/>";
}
sBlogs += @"</PostMonth>";
sBlogs += @"</BlogPosts>";
}
return sBlogs;
} |