I was trying to delete a document in DocumentDB / CosmoDB and I was surprised to be faced with the error message of, ‘PartitionKey value must be supplied’. There doesn’t appear to be a way of passing the partition key to DeleteDocumentAsync. The trick is to use the request options. For example, if your collection is partitioned by ProductID;
await this.documentClient.DeleteDocumentAsync(productDocument._self, new RequestOptions { PartitionKey = new Microsoft.Azure.Documents.PartitionKey(productDocument.ProductID) });
my event has no partition key, so i’m stuck here and can’t delete it. I don’t understand their logic all the information in selflink is already provided to remove the document…. And RequestOptions doesn’t accept null partition key
@Johndoe
Can you please try Microsoft.Azure.Documents.PartitionKey.None in your case.