Foxtable(狐表)用户栏目专家坐堂 → 钉钉接口


  共有3451人关注过本帖树形打印复制链接

主题:钉钉接口

帅哥哟,离线,有人找我吗?
BG小白
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:603 积分:4102 威望:0 精华:0 注册:2019/11/14 23:06:00
钉钉接口  发帖心情 Post By:2021/12/1 2:04:00 [显示全部帖子]

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.SetHttpMethod("GET")
Dim rsp As DingTalk.Api.Response.OapiDepartmentListResponse = client.Execute(req, access_token)
DataTables("表B").DataRows.Clear
For i As Integer = 0 To rsp.Department.count -1 
Dim r As Row
r = Tables("表B").AddNew
r("第一列") = rsp.Department.Item(I).id
r("第二列") = rsp.Department.Item(I).name
r("第三列") = rsp.Department.Item(I).Parentid
Next
DataTables("表B").Save
MessageBox.Show("读取完成")

上面的是用钉钉提供的sdk获取到的所有部门信息

Dim ul As String = "https://oapi.dingtalk.com/department/list?access_token={0}"
Dim hc As New HttpClient(CExp(ul,Functions.Execute("access_token")))
Dim jo As JObject = JObject.Parse(hc.GetData())
If jo("errcode") = "0" Then
    MessageBox.Show("成功")
Else
    MessageBox.Show(jo.ToString)
End If

怎么用上面这种获取所有部门信息呢?红色的部分不知道该怎么实现?获取到的只有根部门,不是所有部门,要获得所有部门必须提供父部门dept_id
[此贴子已经被作者于2021/12/1 2:09:40编辑过]

 回到顶部