1

受保护的无效Button1_Click(对象发送者,EventArgs e){

//Incident Service

        IncidentService.ServiceNowSoapClient soapClient = new IncidentService.ServiceNowSoapClient();
        soapClient.ClientCredentials.UserName.UserName = "username"; // username have SOAP role in SNow.
        soapClient.ClientCredentials.UserName.Password = "Password1";
        IncidentService.getRecords _getRecords = new IncidentService.getRecords();
        IncidentService.getRecordsResponseGetRecordsResult[] getRecordsResponses = soapClient.getRecords(_getRecords);
        _getRecords.active = true;

        // Note: Please enable SOAP/REST services in your SNow dev instance table(s), Also,
        // Go to system web services --> properties -> enable the 3rd option from the bottom.(This property sets the elementFormDefault attribute of the embedded XML schema to the value of unqualified)
        //ServiceNowSoapClient client = new ServiceNowSoapClient();
        //client.ClientCredentials.UserName.UserName = "username"; // username have SOAP role in SNow.
        //client.ClientCredentials.UserName.Password = "Password1";

        //insert newRecord = new insert();
        //insertResponse insertResponse = new insertResponse(); 
        //newRecord.first_name = "Jackson";
        //newRecord.last_name = "Chris";
        //newRecord.phone_number = "911-911-9999";
        //newRecord.number = "CUS3048232";
        try
        {
            //insertResponse = client.insert(newRecord);
            //TextBox1.Text = insertResponse.sys_id;

            getRecordsResponses = soapClient.getRecords(_getRecords);
            for (int i = 0; i < getRecordsResponses.Length; i++)
            {
                TextBox2.Text = getRecordsResponses[i].short_description;
                TextBox3.Text = getRecordsResponses[i].category;
            }
        }
        catch (Exception ex)
        {
            TextBox1.Text = ex.Message;
        }
        //finally { client.Close(); }

}

您如何利用驻留在企业 servicenow(CMDB、ITIL、各种企业 dbs、新 dbs)dev、prod 实例中的 ServiceNow 数据来使用 C#、dotnetcore 创建端到端自动化应用程序。

我们的目标是通过 ServiceNow、dotnetcore、C#、docker 容器、Ansible、Automic 实现端到端的应用程序自动化。

4

1 回答 1

1

我知道您可能不需要,也许寻找相同的人会发现这个问题。

我为此开发了一个库。

https://emersonbottero.github.io/ServiceNow.Core/

于 2022-01-21T23:46:17.030 回答