1

In Microsoft Azure DocumentDb, how can I retrieve a list of all databases? Not documents in a particular database, but all the databases for a particular account. Preferable using the standard DocumentClient class.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241

1 Answers1

3

You could something like the following:

            using (var documentClient = new DocumentClient(new Uri("<endpoint>"), "<accountkey>"))
            {
                var listDatabasesOperationResult = await documentClient.ReadDatabaseFeedAsync();
                foreach (var item in listDatabasesOperationResult)
                {
                    Console.WriteLine(item.Id);
                }
            }
Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • `An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll but was not handled in user code` -- I wonder why? –  Nov 17 '15 at 06:44
  • @jawanam could you please provide the full stack trace for this exception. I've never seen a FileNotFoundException in this SDK before. – Ryan CrawCour Nov 19 '15 at 17:27