Skip to main content
AtomPubClient.CreateResourceAsync | createResourceAsync method

Applies to Windows and Windows Phone

Creates a new Entry resource in the specified collection. The Uri of the collection in which to create the new resource can be discovered from the ResourceCollection object retrieved from the RetrieveResourceAsync method.


atomPubClient.createResourceAsync(uri, description, item).done( /* Your success and error handlers */ );

public IAsyncOperationWithProgress<SyndicationItem, TransferProgress> CreateResourceAsync(
  Uri uri, 
  string description, 
  SyndicationItem item

Public Function CreateResourceAsync(
  uri As Uri,  
  description As String,  
  item As SyndicationItem 
) As IAsyncOperationWithProgress(Of SyndicationItem, TransferProgress)

IAsyncOperationWithProgress<SyndicationItem, TransferProgress>^ CreateResourceAsync(
  Uri^ uri, 
  String^ description, 
  SyndicationItem^ item



Type: Windows.Foundation.Uri [JavaScript] | System.Uri [.NET] | Windows::Foundation::Uri [C++]

The Uri of the specified collection in which the new resource should be created.


Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The description of the new resource that is turned into the Slug: header of the POST request.


Type: SyndicationItem

The new resource to be created.

Return value

Type: IAsyncOperationWithProgress<SyndicationItem, TransferProgress>

The object that is used to create the resource asynchronously and to report the progress and completion status of the operation.


The following code demonstrates how to access a service document and retrieve edit URI values. For additional examples of how AtomPub can be used to manage feed content, download the AtomPub sample.

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

            var title = document.getElementById("titleField").value;
            if (title === "") {
                outputField.innerHTML = "Post title cannot be blank";

            var serviceUri = new Windows.Foundation.Uri(document.getElementById("serviceAddressField").value.trim() + defaultServiceDocUri);
            outputField.innerHTML = "Fetching service document: " + serviceUri.absoluteUri + "</br>";
            findEditUri(serviceUri).then(function (resourceUri) {
                if (!resourceUri) {
                    outputField.innerHTML += "Error: Edit uri not found in service document";
                    return null;

                outputField.innerHTML += "Uploading post: " + resourceUri.absoluteUri + "</br>";

                var item = new Windows.Web.Syndication.SyndicationItem();
                item.title = new Windows.Web.Syndication.SyndicationText(title, Windows.Web.Syndication.SyndicationTextType.text);
                var content = document.getElementById("bodyField").value;
                item.content = new Windows.Web.Syndication.SyndicationContent(content, Windows.Web.Syndication.SyndicationTextType.html);

                return client.createResourceAsync(resourceUri, item.title.text, item);
            }).done(function (result) {
                if (result) {
                    outputField.innerHTML += "Posted at " + result.itemUri.absoluteUri + "</br>";
                    outputField.innerHTML += "Complete</br>";
            }, onError);
        catch (ex) {
            outputField.innerHTML += "Exception:" + ex + "</br>";

Note  See RetrieveServiceDocumentAsync for the code behind the findEditUri function called in this example.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Web::AtomPub [C++]



See also

Quickstart: Managing Feed Entries
AtomPub sample