This Web Part is an alternative to the current SharePoint 2010 Blog Site Archives Web Part which does not support provisioning of pre-dated posts.The Story Behind the Web Part
The OOB SharePoint 2010 site templates are very useful in different scenarios. I am a big fan of SharePoint and I won’t settle for any other platform specially for my blog. The guys at Microsoft were very generous to spare some time and build a site template for blogs. After provisioning the site, I was so happy with it! but then stumbled on the fact that the Archives Web Part did not generate links for my old posts, apparently by design - after doing a decent search over forums - pre dated posts were not provisioned by the Blog Site Template Archives Web Part. I had to remove the Web Part and place a link to the All Posts view on the top link bar and called it Archives. On the long run, it did not sound like a good alternative, I had to have that Web Part.
I spent couple of hours to code an alternative to the Archives Web Part, and I can’t express how happy I was with it. The Logic Behind the Code
The approach was very simple: I had to get all published posts; find out in which years the posts were authored; find out in which months the posts were authored, and finally push all this to a Tree View control.
After populating the Tree View nodes, I had to handle the SelectedNodeChanged event to redirect to the Date.aspx page and pass the correct StartDateTime and EndDateTime query string parameters. The query string structure is fairly easy, you needed to supply the time span parameters and the title. For example, to get all the posts in December 2011 the URL should look like this: http://www.sharepointstack.local/Lists/Posts/Date.aspx?StartDateTime=2011-12-01T00:00:00Z&EndDateTime=2012-01-01T02:00:00Z&LMY=December,%202011
. Notice that the start and end times are passed in ISO8601 formats.
You can find the steps of creating the Web Part with detailed explination of the source code here: http://blogs.msdn.com/b/balsharfi/archive/2012/01/01/sharepoint-2010-blog-site-template-an-alternative-web-part-to-solve-to-the-pre-dated-posts-provisioning-in-the-oob-archives-web-part.aspx