1

I would like to create a Custom Property for a Sandboxed Visual Web Part but I'm not able to do so.

Requirement: I would like to display data of Blog "Posts" List(RSS Feed) in Custom web part by providing the Name of a Sub Site in Custom Property of Web Part.

1

To create a Custom Property for a Sandboxed Visual Web part, you can make use of the below code and link,

[WebBrowsable(true), Personalizable(true)]
public string ListName { get; set; }

Source

Using the above custom property value, find out the ListRssUrl and pass it to the below function to get the data from it.

Here is a small code snippet to parse sharepoint blog posts list’s Rss feed.

protected string GetRSS(string ListRssUrl)
{

string rss_text = “”;
string title = “”;
string link = “”;
string description = “”;

XPathDocument doc = new XPathDocument(ListRssUrl);
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator items = nav.Select(“//item”);

while (items.MoveNext())
{
XPathNavigator navCurrent = items.Current;

title = navCurrent.SelectSingleNode(“title”).InnerXml;
link = navCurrent.SelectSingleNode(“link”).InnerXml;
description = navCurrent.SelectSingleNode(“description”).InnerXml;
}
}

Source

In your webpart, you can use a grid to display the title, link, description, etc.

Hope this helps you.

0

Check out the option explained in this post How to create a custom property and set a default value in a SharePoint 2013 Visual WebPart

  • 2
    Please, do not only provide a link. It is better if you try to summarize the content and post it here (of course with a reference to the page). Thanks, and welcome to SP.SE! :) – Robert Lindgren Nov 7 '13 at 9:06
  • 1
    Also we require disclosure of any affiliation with products or websites. Please see May I promote products or websites I am affiliated with here? for guidelines. No big deal in this case, but for future reference. Welcome to the site. – SPDoctor Nov 11 '13 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.