Recently I created an API App for DocumentDB.

While testing it I kept getting errors about a invalid URI.

I was using System.Uri to create the collectionLink that is passed into ExecuteStoredProcedureAsync<ListResults>(collectionLink, filterQuery, continuationToken); 

The DocumentDB Client provides the buy Lyrica australia UriFactory class, which is a  helper class, that makes it easier to create the various Uris needed for use with the DocumentClient.

var collectionLink = UriFactory.CreateStoredProcedureUri(DocumentDbContext.DatabaseId, DocumentDbContext.CollectionId, DocumentDbContext.ProcedureId);

Using the UriFactory one can create links for the following:

  • Database
  • Document Collection
  • User
  • Document
  • Permission
  • Stored Procedure
  • Trigger
  • User Defined Function (UDF)
  • Conflict
  • Attachment