Currently, I'm working on adding a "previous blog" and "next blog" link to an ASP.net C# application that feeds its blog from a customer's blog hosted on blogspot. Once I grab a specific blog, I then want to get its immediately previous blog and immediately next blog. To get the previous blog isn't hard.
// THIS IS MY CALL TO GET THE PREVIOUS BLOG
FeedQuery prevQuery = new FeedQuery();
prevQuery.Uri = new Uri(String.Format("{0}", blogCred.feedUri));
// {0} This is automatically retrieved from the database [ https://www.blogger.com/feeds/XXXXXXXXXXXXXXXXXX/posts/default/ ]
prevQuery.MaxPublication = entry.Published.AddSeconds(-1);
prevQuery.NumberToRetrieve = 1;
AtomFeed prevFeed = googleService.Query(prevQuery);
AtomEntry prevEntry = prevFeed.Entries.FirstOrDefault();
prevBlog(prevEntry);
This gets me the result I want. The problem is getting the next blog.
// THIS IS MY CALL TO GET THE NEXT BLOG
FeedQuery nextQuery = new FeedQuery();
nextQuery.Uri = new Uri(String.Format("{0}", blogCred.feedUri));
// {0} This is automatically retrieved from the database [ https://www.blogger.com/feeds/XXXXXXXXXXXXXXXXXX/posts/default/ ]
nextQuery.MinPublication = entry.Published.AddSeconds(1);
nextQuery.NumberToRetrieve = 1;
AtomFeed nextFeed = googleService.Query(nextQuery);
AtomEntry nextEntry = nextFeed.Entries.FirstOrDefault();
nextBlog(nextEntry);
The problem I'm having is that I can't get Blogger to order through these posts in a descending order. It keeps sorting through them in an ascending order and grabbing the latest blog that's been posted, rather than the next post. I don't want to grab the FULL xml file with all the blog posts and grabbing the last item. I want to get the last item in a similar fashion to this LINQ to SQL call:
var query = from f in nextEntry
where f.date > desiredDate
orderby date descending
select f;
If anyone has any ideas or anything I'm missing - hopefully something as simple as getting the "next post" link from somewhere in the entry that's spat back from Google's response.