AtomPubClient.RetrieveServiceDocumentAsync(Uri) 方法

定义

从指定的 URI 检索服务文档。

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

参数

uri
Uri Uri

指定的 URI。

返回

对象,用于异步检索服务文档并报告操作的进度和完成状态。

属性

示例

以下代码演示如何访问服务文档并检索编辑 URI 值。 有关如何使用 AtomPub 管理源内容的其他示例,请下载 AtomPub 示例

function findEditUri(serviceUri) {
    return client.retrieveServiceDocumentAsync(serviceUri).then(function (serviceDocument) {
        for (var i in serviceDocument.workspaces) {
            var workspace = serviceDocument.workspaces[i];
            for (var j in workspace.collections) {
                var collection = workspace.collections[j];

                if (collection.accepts.join(";") === "application/atom+xml;type=entry") {
                    return collection.uri;
                }
            }
        }

        return null;
    });
}

适用于

另请参阅