AtomPubClient.RetrieveFeedAsync(Uri) 方法

定义

启动异步操作以从给定 URI 下载联合源。 此方法从源字符串实例化 一个 SyndicationFeed 对象,该对象可以是 SyndicationFormat 中指定的格式之一。

public:
 virtual IAsyncOperationWithProgress<SyndicationFeed ^, RetrievalProgress> ^ RetrieveFeedAsync(Uri ^ uri) = RetrieveFeedAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperationWithProgress<SyndicationFeed, RetrievalProgress> RetrieveFeedAsync(Uri const& uri);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperationWithProgress<SyndicationFeed,RetrievalProgress> RetrieveFeedAsync(System.Uri uri);
function retrieveFeedAsync(uri)
Public Function RetrieveFeedAsync (uri As Uri) As IAsyncOperationWithProgress(Of SyndicationFeed, RetrievalProgress)

参数

uri
Uri Uri

从中下载源的 URI。

返回

包含操作的结果。

实现

M:Windows.Web.Syndication.ISyndicationClient.RetrieveFeedAsync(Windows.Foundation.Uri) M:Windows.Web.Syndication.ISyndicationClient.RetrieveFeedAsync(System.Uri)
属性

示例

以下代码演示如何使用 AtomPubClient 在特定服务地址检索源。 有关如何使用 AtomPub 管理源内容的其他示例,请下载 AtomPub 示例

function retieveFeed() {
    try {
        // Refresh client in case server url or credential have changed.
        createClient();

        // Note that this feed is public by default and will not require authentication.
        // We will only get back a limited use feed, without information about editing.
        var resourceUri = new Windows.Foundation.Uri(document.getElementById("serviceAddressField").value.trim() + defaultFeedUri);

        outputField.innerHTML = "Fetching resource: " + resourceUri.absoluteUri + "/br";
        client.retrieveFeedAsync(resourceUri).done(function (feed) {
            currentFeed = feed;
            currentItemIndex = 0;

            outputField.innerHTML += "Complete</br>";
            displayCurrentItem();
        }, onError);
    }
    catch (ex) {
        outputField.innerHTML += "Exception:" + ex + "</br>";
    }
}

适用于

另请参阅