I created a project wiki in Azure DevOps and want to get the wiki markdown pages in my .NET application. When using the link
https://dev.azure.com/company/project/_apis/wiki/wikis/KIS.wiki/pages/News
The markdown gets shown in the browser. When I try to do that in code, I am getting
"Wiki page ‘/News/_apis/connectionData’ could not be found. Ensure that the path of the page is correct and the page exists."
My code looks like this:
var url = new Uri("https://dev.azure.com/company/project/_apis/wiki/wikis/KIS.wiki/pages/News");
var personalAccessToken = "xxxxxxxxxxxxxxxx";
var credentials = new VssCredentials(new VssBasicCredential("", personalAccessToken));
using (var connection = new VssConnection(url, credentials))
{
var wikiClient = connection.GetClient<WikiHttpClient>();
var markdown = wikiClient.GetWikiAsync("KIS.wiki").Result;
}
The error appears on GetClient().
What am I doing wrong?