Dim access_token As String =Functions.Execute("access_token")
Dim id As String ="1" \' args(1)
Dim client As DingTalk.Api.IDingTalkClient = new DingTalk.Api.DefaultDingTalkClient("https://oapi.dingtalk.com/department/list")
Dim req As DingTalk.Api.Request.OapiDepartmentListRequest = new DingTalk.Api.Request.OapiDepartmentListRequest()
req.Id = "1"
req.SetHttpMethod("GET")
Dim rsp As DingTalk.Api.Response.OapiDepartmentListResponse = client.Execute(req, access_token)
Dim jo As JObject = JObject.Parse(rsp.body)
Dim ja As JArray = jo("department")
Dim dr As DataRow
For i As Integer = 0 To ja.Count - 1
dr = DataTables("departmentlist").Find("部门ID = \'" & ja(i)("id").Tostring & "\'")
If dr Is Nothing Then
dr=DataTables("departmentlist").addnew()
dr("部门名称")=ja(i)("name")
dr("部门ID")=ja(i)("id").Tostring
dr.save()
End If
Next
代码应该没问题,函数:Functions.Execute("access_token") ,没有问题,单独执行是可以有结果的。昨晚在家都很正常的,是否是运行环境缺少点什么,谢谢!