sharepoint-2010mysitespcontextweb-parts

Access a MySite Blog from a home page webpart


I've been away from SharePoint development for quite a while now, and I'm trying to access the information in a SharePoint 2010 blog (from one of our users, within their "MySite") from a C# webpart which will reside on the homepage of the site. The idea is to be able to highlight a certain user's latest post on the home page.

Can anyone help me to reference the blog (in dev it is located at http://myServer/my/BillsBlog) from our homepage. I've tried the following...

Once I find the appropriate container (SPSite or SPWeb) I can access the list to pull out the items I need, but I don't know how to get to that point. In a console App, I have it working by using the method in the first bullet abouve.

I'm really pretty much stuck now, and I simply don't know enough about what I'm looking fro to be able to search Google for answers. Any help you could give me would be greatly appreciated.


Solution

  • OK, my mistake. The webpart project was set up as a sandboxed one, so the approach in bullet 1 wouldn't work. Changing that switch meant it is now OK and working as per the console app.

    Thanks for reading.