Friday, August 3, 2012

SharePoint 2010: Custom Rss Feed for Document Library


Here is the good post for custom Rss Feed. It worked for me.


 If you are working for document library replace “LinkTitle” with Title as shown below code.

foreach (SPListItem item in items)
          {
              sb.Append("<item>");
              AddTag("title", item["Title"].ToString(), sb);
              //AddTag("link", list.RootFolder.Url + "/DispForm.aspx?ID=" + item.ID, sb);

             // AddTag("link", "http://site/News/default.aspx?itemid=" + item.ID, sb);

             AddTag("link", "http://site/news/default.aspx?itemid=" + item.ID, sb);
              //AddTag("link", listurl  + item.ID, sb);
             
              sb.Append("<description>");
             
              foreach (string viewField in view.ViewFields)
              {

                  if (viewField != "Title")
                  //if (viewField != "LinkTitle")
                  {
                      AddTag(viewField.Replace("_x0020_", " "),item.GetFormattedValue(viewField), sb);
                  }
              }
              sb.Append("</description>");
              sb.Append("</item>");
          }

No comments:

Post a Comment

Followers