Syndication​Item Syndication​Item Syndication​Item Class

Definition

Represents an item in the feed. This class encapsulates information in the /rss/channel/item element in RSS 2.0 or the atom:entry element in Atom 1.0.

public sealed class SyndicationItem : ISyndicationItem, ISyndicationNodepublic sealed class SyndicationItem : ISyndicationItem, ISyndicationNodePublic NotInheritable Class SyndicationItem Implements ISyndicationItem, ISyndicationNode
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The following code demonstrates how to access the property values of a SyndicationItem object.


function displayCurrentItem() {
    var item = currentFeed.items[currentItemIndex];

    // Title.
    var title = item.title || "(no title)";
    document.getElementById("feedItemTitle").innerText = title;

    // Display the main link.
    var link = "";
    if (item.links.size > 0) {
        link = item.links[0].uri.absoluteUri;
    }

    var feedLink = document.getElementById("feedLink");
    feedLink.innerText = link;
    feedLink.href = link;

    // Display the body as HTML.
    var content = item.content || item.summary || "(no content)";
    document.getElementById("feedWebView").innerHTML = content;
}

using Windows.Foundation;
using Windows.Web.Syndication;

private void DisplayCurrentItem()
{
    SyndicationItem item = currentFeed.Items[currentItemIndex];

    // Title
    FeedItemTitle.Text = item.Title != null ? item.Title.Text : "(no title)";

    // Display the main link
    string link = string.Empty;
    if (item.Links.Count > 0)
    {
    link = item.Links[0].Uri.AbsoluteUri;
    }
    FeedLink.Content = link;

    // Display the body as HTML
    string content = "(no content)";
    if (item.Content != null)
    {
        content = item.Content.Text;
    }
    else if (item.Summary != null)
    {
        content = item.Summary.Text;
    }
    FeedWebView.NavigateToString(content);
}

For additional examples that demonstrate how this class is used to represent feed content, see Quickstart: Accessing a web feed.

The following table maps SyndicationItem properties to RSS and Atom feed elements.

SyndicationItemRSS Channel/ItemAtom entryAtomPub
AttributeExtensions (foreign markup)
Authors authorauthors
BaseUri
Categories categorycategory
CommentsUri comments
Content content
Contributors contributor
EditMediaUri link with rel="edit-media"
EditUri link with rel="edit"
ElementExtensions (foreign markup)
EtagETag header after CreateResourceAsync
Id guididLocation header after CreateResourceAsync
ItemUri
Language xml:langxml:lang
LastUpdatedTime updated
Links link/enclosurelink
NodeName
NodeNamespace
NodeValue
PublishedDate pubDatepublished
Rights rights
Source sourcesource
Summary descriptionsummary
Title titletitle

Constructors

SyndicationItem() SyndicationItem() SyndicationItem()

Creates a new SyndicationItem object.

public SyndicationItem()public SyndicationItem()Public Sub New()
Attributes

SyndicationItem(String, SyndicationContent, Uri) SyndicationItem(String, SyndicationContent, Uri) SyndicationItem(String, SyndicationContent, Uri)

Creates a new SyndicationItem object with a title, content, and URI.

public SyndicationItem(String title, SyndicationContent content, Uri uri)public SyndicationItem(String title, SyndicationContent content, Uri uri)Public Sub New(title As String, content As SyndicationContent, uri As Uri)
Parameters
title
System.String System.String System.String

Title of the new item.

content
SyndicationContent SyndicationContent SyndicationContent

The content for this feed item.

uri
Uri Uri Uri

The URI associated with this item.

Attributes

Properties

AttributeExtensions AttributeExtensions AttributeExtensions

Gets the list of custom attributes of the element.

public IVector<SyndicationAttribute> AttributeExtensions { get; }public IVector<SyndicationAttribute> AttributeExtensions { get; }Public ReadOnly Property AttributeExtensions As IVector<SyndicationAttribute>
Value

A list of attributes of the element.

Attributes

Authors Authors Authors

Gets the authors of an item. This property represents the collection of all the atom:author elements under atom:entry.

public IVector<SyndicationPerson> Authors { get; }public IVector<SyndicationPerson> Authors { get; }Public ReadOnly Property Authors As IVector<SyndicationPerson>
Value

The collection of all the atom:author elements under atom:entry.

Attributes

BaseUri BaseUri BaseUri

Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element.

public Uri BaseUri { get; set; }public Uri BaseUri { get; set; }Public ReadWrite Property BaseUri As Uri
Value
Uri Uri Uri

The xml:base attribute on the element.

Attributes

Categories Categories Categories

Gets a collection of categories of the feed. This property represents the collection of all the atom:category elements under atom:feed.

public IVector<SyndicationCategory> Categories { get; }public IVector<SyndicationCategory> Categories { get; }Public ReadOnly Property Categories As IVector<SyndicationCategory>
Value

The collection of all atom:category elements under atom:feed.

Attributes

CommentsUri CommentsUri CommentsUri

Gets or sets the Uniform Resource Identifier (URI) of the comments for the item. This property represents the /rss/channel/item/comments element.

public Uri CommentsUri { get; set; }public Uri CommentsUri { get; set; }Public ReadWrite Property CommentsUri As Uri
Value
Uri Uri Uri

The /rss/channel/item/comments element.

Attributes

Content Content Content

Gets or sets the content of the item.

public SyndicationContent Content { get; set; }public SyndicationContent Content { get; set; }Public ReadWrite Property Content As SyndicationContent
Attributes

Contributors Contributors Contributors

Gets a collection of the contributors of the feed. This property represents the collection of all the atom:contributor elements under atom:feed.

public IVector<SyndicationPerson> Contributors { get; }public IVector<SyndicationPerson> Contributors { get; }Public ReadOnly Property Contributors As IVector<SyndicationPerson>
Value

The collection of all atom:contributor elements under atom:feed.

Attributes

EditMediaUri EditMediaUri EditMediaUri

Gets the Uniform Resource Identifier (URI) of an editable media resource.

public Uri EditMediaUri { get; }public Uri EditMediaUri { get; }Public ReadOnly Property EditMediaUri As Uri
Value
Uri Uri Uri

The atom:link element with the attribute rel=”edit-media”.

Attributes

Remarks

This property represents the atom:link element with the attribute rel=”edit-media”. It is the absolute Uniform Resource Identifier (URI) resolved against the xml:base attribute, if it is present. If the href attribute is a relative Uniform Resource Identifier (URI) string and there is no xml:base attribute, this property will be null since the relative Uniform Resource Identifier (URI) is not supported by the runtime Uniform Resource Identifier (URI) class.

EditUri EditUri EditUri

Gets the Uniform Resource Identifier (URI) of an editable resource.

public Uri EditUri { get; }public Uri EditUri { get; }Public ReadOnly Property EditUri As Uri
Value
Uri Uri Uri

The atom:link element with rel="edit".

Attributes

Remarks

This property represents the atom:link element with the attribute rel=”edit”. It is the absolute Uniform Resource Identifier (URI) resolved against the xml:base attribute, if it is present. If the href attribute is a relative Uniform Resource Identifier (URI) string and there is no xml:base attribute, this property will be null since the relative Uniform Resource Identifier (URI) is not supported by the runtime Uniform Resource Identifier (URI) class.

ElementExtensions ElementExtensions ElementExtensions

Gets the list of child elements within the element.

public IVector<ISyndicationNode> ElementExtensions { get; }public IVector<ISyndicationNode> ElementExtensions { get; }Public ReadOnly Property ElementExtensions As IVector<ISyndicationNode>
Value

The list of child elements within the element.

Attributes

Remarks

The following elements in the RSS 2.0 documents do not have public accessors;they can be accessed by searching the ElementExtensions collection on the SyndicationFeed object:

  • /rss/channel/docs
  • /rss/channel/cloud
  • /rss/channel/pubDate
  • /rss/channel/webmaster
  • /rss/channel/ttl
  • /rss/channel/rating
  • /rss/channel/textInput
  • /rss/channel/skipDays
  • /rss/channel/skipHours

ETag ETag ETag

Gets an ETag HTTP header.

public PlatForm::String ETag { get; }public string ETag { get; }Public ReadOnly Property ETag As string
Value
string string string

An Etag HTTP header.

Attributes

Remarks

When an AtomPub endpoint returns a syndication entry, it may include an ETag HTTP header, which will be tied to the SyndicationItem object and show up in this property. AtomPubClient will also use ETag when updating or deleting a resource for synchronization control.

Id Id Id

Gets or sets the identifier for the syndication feed.

public PlatForm::String Id { get; set; }public string Id { get; set; }Public ReadWrite Property Id As string
Value
string string string

The atom:Id element or the guid element in RSS 2.0.

Attributes

ItemUri ItemUri ItemUri

Gets the Uniform Resource Identifier (URI) of this item. AtomPubClient creates this property after new resource is created.

public Uri ItemUri { get; }public Uri ItemUri { get; }Public ReadOnly Property ItemUri As Uri
Value
Uri Uri Uri

The Uniform Resource Identifier (URI) of the item.

Attributes

Language Language Language

Gets or sets the language of the element. This property represents the xml:lang attribute on the element. It may be inherited from an ancestor element. It must be valid according to XML 1.0.

public PlatForm::String Language { get; set; }public string Language { get; set; }Public ReadWrite Property Language As string
Value
string string string

The xml:lang attribute on the element.

Attributes

LastUpdatedTime LastUpdatedTime LastUpdatedTime

Gets or sets the most recent time the item was modified. This property represents the atom:updated element.

public DateTime LastUpdatedTime { get; set; }public DateTimeOffset LastUpdatedTime { get; set; }Public ReadWrite Property LastUpdatedTime As DateTimeOffset
Value
DateTime DateTime DateTime

The atom:updated element.

Attributes

Links Links Links

Gets the links contained in the item.

public IVector<SyndicationLink> Links { get; }public IVector<SyndicationLink> Links { get; }Public ReadOnly Property Links As IVector<SyndicationLink>
Value

The collection of all the atom:link elements under atom:entry.

Attributes

Remarks

This property represents the collection of all the atom:link elements under atom:entry. For RSS 2.0, this collection includes link, enclosure, and comments elements.

NodeName NodeName NodeName

Gets or sets the local name of the element.

public PlatForm::String NodeName { get; set; }public string NodeName { get; set; }Public ReadWrite Property NodeName As string
Value
string string string

The local name of the element. Must be valid according to XML 1.0.

Attributes

NodeNamespace NodeNamespace NodeNamespace

Gets or sets the namespace of the element.

public PlatForm::String NodeNamespace { get; set; }public string NodeNamespace { get; set; }Public ReadWrite Property NodeNamespace As string
Value
string string string

The namespace of the element.

Attributes

NodeValue NodeValue NodeValue

Gets or sets the text content of the element. If the element contains only child elements, this property is NULL.

public PlatForm::String NodeValue { get; set; }public string NodeValue { get; set; }Public ReadWrite Property NodeValue As string
Value
string string string

The text content of the element.

Attributes

PublishedDate PublishedDate PublishedDate

Gets or sets the date the item was published.

public DateTime PublishedDate { get; set; }public DateTimeOffset PublishedDate { get; set; }Public ReadWrite Property PublishedDate As DateTimeOffset
Value
DateTime DateTime DateTime

The atom:published element under atom:entry or the pubDate element under item element in RSS 2.0.

Attributes

Rights Rights Rights

Gets or sets information about the rights of an item. This property represents the atom:rights element.

public ISyndicationText Rights { get; set; }public ISyndicationText Rights { get; set; }Public ReadWrite Property Rights As ISyndicationText
Value
ISyndicationText ISyndicationText ISyndicationText

The atom:rights element.

Attributes

Source Source Source

Gets or sets the source feed of the item. This property represents the atom:source element or the source element in RSS 2.0.

public SyndicationFeed Source { get; set; }public SyndicationFeed Source { get; set; }Public ReadWrite Property Source As SyndicationFeed
Value
SyndicationFeed SyndicationFeed SyndicationFeed

The atom:source element or the source element in RSS 2.0.

Attributes

Summary Summary Summary

Gets or sets a summary of the item.

public ISyndicationText Summary { get; set; }public ISyndicationText Summary { get; set; }Public ReadWrite Property Summary As ISyndicationText
Value
ISyndicationText ISyndicationText ISyndicationText

The atom:summary element or the description element in RSS 2.0.

Attributes

Title Title Title

Gets or sets the title of the item.

public ISyndicationText Title { get; set; }public ISyndicationText Title { get; set; }Public ReadWrite Property Title As ISyndicationText
Value
ISyndicationText ISyndicationText ISyndicationText

The atom:title element.

Attributes

Methods

GetXmlDocument(SyndicationFormat) GetXmlDocument(SyndicationFormat) GetXmlDocument(SyndicationFormat)

Generates the DOM object that represents this element, all the attributes and child elements including foreign markups. The only formats accepted by this method are Atom 1.0 and RSS 2.0.

public XmlDocument GetXmlDocument(SyndicationFormat format)public XmlDocument GetXmlDocument(SyndicationFormat format)Public Function GetXmlDocument(format As SyndicationFormat) As XmlDocument
Parameters
format
SyndicationFormat SyndicationFormat SyndicationFormat

The format of the data.

Returns

The DOM object that represents this element, and all the attributes and child elements, including foreign markups.

Attributes

Load(String) Load(String) Load(String)

Initializes the object from the given feed string, which can be in either RSS 2.0 or Atom 1.0 format.

public void Load(String item)public void Load(String item)Public Function Load(item As String) As void
Parameters
item
System.String System.String System.String

The feed string, which can be in either RSS 2.0 or Atom 1.0 format.

Attributes

LoadFromXml(XmlDocument) LoadFromXml(XmlDocument) LoadFromXml(XmlDocument)

Initializes the object from the given DOM object, which can contain XML content in either RSS 2.0 or Atom 1.0 format.

public void LoadFromXml(XmlDocument itemDocument)public void LoadFromXml(XmlDocument itemDocument)Public Function LoadFromXml(itemDocument As XmlDocument) As void
Parameters
itemDocument
XmlDocument XmlDocument XmlDocument

The DOM object, which can contain XML content in either RSS 2.0 or Atom 1.0 format.

Attributes

See Also