Skip to content
Using the Microsoft QnA Maker API -- samples in C#.
Branch: master
Clone or download
bingisbestest Merge pull request #13 from bingisbestest/master
Adding CSharp quickstarts for QnAMaker
Latest commit a6e34f1 Jun 21, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Initial commit Jul 13, 2018
documentation-samples Adding CSharp quickstarts for QnAMaker Jun 20, 2019
.gitignore Initial commit Jul 13, 2018 Initial commit Jul 13, 2018 Initial commit Jul 13, 2018 Initial commit Jul 13, 2018 doc quickstart change Oct 9, 2018
create-knowledge-base.cs doc quickstart change Oct 9, 2018
delete-knowledge-base.cs Initial commit Sep 12, 2018
download-knowledge-base.cs Initial commit Jul 18, 2018
find-kb-id.png Added KB image Sep 12, 2018
publish-knowledge-base.cs doc quickstart change Oct 9, 2018
update-knowledge-base.cs doc quickstart change Oct 9, 2018

Cognitive Services QnA Maker Samples in C#

These REST samples show you how to programmatically create, update, publish, and replace a QnA Maker knowledge base, amongst many other ways to interact with it. All samples are in C#. To view these same samples in other languages:





Included are the following samples:

All REST samples revolve around what you can do with a knowledge base, which is made up of FAQs or product manuals where there is a question and an answer. QnA Maker gives you more control over how to answer questions by allowing you to train a chat bot to give answers in a variety of ways that feels more like natural, conversational exchanges.

Getting Started


For each sample, a subscription key is required from your Azure Portal account.

  • To create a new account/resource for QnA Maker, see Create a Cognitive Services API account in the Azure portal. You may need to 'Search in Marketplace' for QnA Maker if you don't see it in the list given.
  • For existing accounts, the key can be found in your Azure Portal dashboard in your QnA Maker resource under Resource Management > Keys. You'll need this key to add to your sample before running.

With the exception of creating a new knowledge base, these samples will require your QnA Maker account knowledge base ID. To find your knowledge base ID, go to My knowledge bases and select View Code on the right. You'll see the http request and your knowledge base ID is in the topmost line: for example, POST /knowledgebases/2700e6b9-91a1-41e9-a958-6d1a98735b10/.... Use only the ID.

Run sample

  1. Create a C# Console App (.NET Framework) in Visual Studio 2017, then add the sample you want to try to Program.cs. For example, if you want to try create-new-knowledge-base.cs. Copy/paste the code from there into your Program.cs.

  2. You can either create one console app per sample, or add a bunch of samples to one console app as projects, then run them separately.

  3. Install the Newtonsoft.Json NuGet package.

  4. Read the comments in the code sample to see where you add your keys.

  5. Run the sample.


Web app bot


QnA Maker V4.0

You can’t perform that action at this time.