I have installed "Microsoft.TeamFoundationServer.Client" package in VS and creating DevOps Work item forms. I want to add custom Rules to the work item form using below code. When running below code I am getting the 'result' value as html content
output: "Azure DevOps Services | Sign In"
Code:
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://dev.azure.com/orgname/_apis/work/processes/processid/workItemTypes/Microsoft.VSTS.WorkItemTypes.Epic/rules?api-version=6.0-preview.2");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = @"{
'name': 'customRule',
'conditions': [
{
'conditionType': '$when',
'field': 'Custom.parentdrpdwn',
'value': 'value1'
}
],
'actions': [
{
'actionType': '$setDefaultValue',
'targetField': 'Custom.childrpdwn',
'value': 'value2'
}
],
'isDisabled': false
}";
streamWriter.Write(json);
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
because of this authentication issue I am not able to post the https request ,how can we authorize the Azure DevOps in the same method and create custom business rule in my Org ?
question from:
https://stackoverflow.com/questions/65913497/how-to-authorize-azure-devops-using-c-sharp-api 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…