0

Does anyone know if there is a way to access blog posts in a custom web part using SharePoint 2013? I've accessed a list like this:

SPSite site = new SPSite("http://site/sites/publish/Lists");
SPWeb web = site.OpenWeb();
SPList list = web.Lists["Research Publications"];

but I don't see a SPBlog or similar object for blogs.

Fenoec
  • 179
  • 2
  • 8

2 Answers2

0

You have Permission to access?

You are in a sandbox?

Sandbox dont reat external bases..

0

Oh, duh. The actual posts in a blog are simply a list and I can connect to the blog directly with SPSite since it is a subsite...so this code grabs the posts from my "announcements" blog subsite.

SPSite site = new SPSite("http://site/sites/publish/announcements");
SPWeb web = site.OpenWeb();
SPList posts = web.Lists["Posts"];
Fenoec
  • 179
  • 2
  • 8