Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token={0}&department_id=1&fetch_child=1&status=0"
Dim hc As New HttpClient(CExp(ur,Functions.Execute("GetQYAccessToken")))
Dim jo As JObject = JObject.Parse(hc.GetData())
If jo("errcode") = "0" Then
DataTables("Users").DataRows.Clear
Dim nms() As String = {"userid","name","position","mobile","gender","email","weixinid","avatar","status"} '""
For Each jt As JToken In jo("userlist")
Dim dr As DataRow = DataTables("Users").AddNew()
For Each nm As String In nms
dr(nm) = jt(nm)
Next
If dr("department") IsNot Nothing
dr("department") = CompressJson(jt("department")).Trim("[","]")
End If
If jt("extattr") IsNot Nothing Then
dr("extattr") = ComPressJson(jt("extattr")("attrs")).Trim("[","]")
End If
Next
DataTables("Users").Save()
Else
MessageBox.Show(jo.ToString)
End If