Syndication​Client Syndication​Client Syndication​Client Class

Definition

Implements the ISyndicationClient interface which retrieves feeds from a URI asynchronously.

public sealed class SyndicationClient : ISyndicationClientpublic sealed class SyndicationClient : ISyndicationClientPublic NotInheritable Class SyndicationClient Implements ISyndicationClient
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 retrieve a feed using RetrieveFeedAsync.

function GetFeed(feedUri) {
     var uri = new Windows.Foundation.Uri(feedUri);
     var client = new Windows.Web.Syndication.SyndicationClient();
     client.bypassCacheOnRetrieve = true;
     client.retrieveFeedAsync(uri).then(function (feed) {
            currentFeed = feed;
     }
}

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

async void GetFeed(feedUri){
      Uri uri = new Uri(feedUri);
      SyndicationClient client = new SyndicationClient();
      client.BypassCacheOnRetrieve = true;
      currentFeed = await client.RetrieveFeedAsync(uri);
}

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

Constructors

SyndicationClient() SyndicationClient() SyndicationClient()

Creates a new SyndicationClient object.

public SyndicationClient()public SyndicationClient()Public Sub New()
Attributes

SyndicationClient(PasswordCredential) SyndicationClient(PasswordCredential) SyndicationClient(PasswordCredential)

Creates a new SyndicationClient object with authentication credentials.

public SyndicationClient(PasswordCredential serverCredential)public SyndicationClient(PasswordCredential serverCredential)Public Sub New(serverCredential As PasswordCredential)
Parameters
serverCredential
PasswordCredential PasswordCredential PasswordCredential

Credentials for user authentication.

Attributes

Properties

BypassCacheOnRetrieve BypassCacheOnRetrieve BypassCacheOnRetrieve

Gets or sets a Boolean value that specifies whether to bypass the cache when retrieving the feed.

public bool BypassCacheOnRetrieve { get; set; }public bool BypassCacheOnRetrieve { get; set; }Public ReadWrite Property BypassCacheOnRetrieve As bool
Value
bool bool bool

TRUE if the cache should be bypassed; otherwise FALSE.

Attributes

MaxResponseBufferSize MaxResponseBufferSize MaxResponseBufferSize

Gets or sets the maximum number of bytes to buffer when receiving a response from a server.

public uint MaxResponseBufferSize { get; set; }public uint MaxResponseBufferSize { get; set; }Public ReadWrite Property MaxResponseBufferSize As uint
Value
uint uint uint

Maximum size and default is UInt32.MaxValue.

Attributes

Remarks

Applications can protect themselves against a malicious server which sends an excessively large response body to DoS the client by setting the property to a smaller number.

If the response from the server contains a Content-Length header with a value greater than the value of this property, the request will be aborted immediately and the operation will immediately fail with an error indicating that the response body was too large. If no Content-Length header is present in the response, the response body will be buffered up to the point of this value. As soon as the response body grows to be larger than this value, the request will be aborted, the buffered response data will be released, and the operation will immediately fail with an error indicating that the response body was too large.

ProxyCredential ProxyCredential ProxyCredential

Gets or sets the credentials to use when making requests via a proxy.

public PasswordCredential ProxyCredential { get; set; }public PasswordCredential ProxyCredential { get; set; }Public ReadWrite Property ProxyCredential As PasswordCredential
Attributes

ServerCredential ServerCredential ServerCredential

Gets or sets the credentials to use when making requests to the server.

public PasswordCredential ServerCredential { get; set; }public PasswordCredential ServerCredential { get; set; }Public ReadWrite Property ServerCredential As PasswordCredential
Value
PasswordCredential PasswordCredential PasswordCredential

Initally, this value is a username/password tuple. For domain credentials, the username is in domain\user form.

Attributes

Timeout Timeout Timeout

Gets or sets the maximum amount of time, in milliseconds, to wait for any of the asynchronous operations to complete. If the operation is not complete within this amount of time, it will fail with a status code indicating that it timed out.

public uint Timeout { get; set; }public uint Timeout { get; set; }Public ReadWrite Property Timeout As uint
Value
uint uint uint

Default value is 30000 (30 seconds). A value of UInt32.MaxValue indicates that the syndication client will wait indefinitely for a response.

Attributes

Methods

RetrieveFeedAsync(Uri) RetrieveFeedAsync(Uri) RetrieveFeedAsync(Uri)

Starts an asynchronous operation to download the syndication feed from the given URI. This method instantiates a SyndicationFeed object from the feed string, which can be in one of the formats specified in SyndicationFormat.

public IAsyncOperationWithProgress<SyndicationFeed, RetrievalProgress> RetrieveFeedAsync(Uri uri)public IAsyncOperationWithProgress<SyndicationFeed, RetrievalProgress> RetrieveFeedAsync(Uri uri)Public Function RetrieveFeedAsync(uri As Uri) As IAsyncOperationWithProgress( Of SyndicationFeed, RetrievalProgress )
Parameters
uri
Uri Uri Uri

The URI from which the feed is downloaded.

Returns

Contains the results of the operation.

Attributes

SetRequestHeader(String, String) SetRequestHeader(String, String) SetRequestHeader(String, String)

Sets an HTTP header for the request. This method can be called multiple times to set multiple headers. When the same header is set multiple times, the values will be concatenated and separated by ",".

public void SetRequestHeader(String name, String value)public void SetRequestHeader(String name, String value)Public Function SetRequestHeader(name As String, value As String) As void
Parameters
name
System.String System.String System.String

The name of the header.

value
System.String System.String System.String

The value of the header.

Attributes

See Also