以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]无法将类型为“System.Int64”的对象强制转换为类型“System.Collections.Generic.List`1[System.Int64] (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=145576) |
-- 作者:81538475 -- 发布时间:2020/1/31 16:11:00 -- [求助]无法将类型为“System.Int64”的对象强制转换为类型“System.Collections.Generic.List`1[System.Int64] 错误所在事件:自定义函数UpdateUser 详细错误信息: 调用的目标发生了异常。 无法将类型为“System.Int64”的对象强制转换为类型“System.Collections.Generic.List`1[System.Int64]”。 设置了一个函数 UpdateUser \'--更新部门信息 Dim access_token As String = Functions.Execute("access_token") Dim Userid As String = args(0) Dim Department As List(Of Long) =args(1) Dim client As DingTalk.Api.IDingTalkClient = New DingTalk.Api.DefaultDingTalkClient("https://oapi.dingtalk.com/user/update") Dim req As DingTalk.Api.Request.OapiUserUpdateRequest = New DingTalk.Api.Request.OapiUserUpdateRequest() req.Userid = Userid req.Department = Department Dim rsp As DingTalk.Api.Response.OapiUserUpdateResponse = client.Execute(req, access_token) Output.show(rsp.errmsg) 再调用的时候报错 Dim getdepartmentID As Long = 111111111 If getdepartmentID > 0 Then Dim departmentID As New List(of Long) departmentID.Add(getdepartmentID) Functions.Execute("UpdateUser", CurrentTable.Current("DingID"),getdepartmentID) End If 测试了一下,如果不用函数,直接代码的话,是不会报错的. |
-- 作者:有点蓝 -- 发布时间:2020/1/31 16:14:00 -- Functions.Execute("UpdateUser", CurrentTable.Current("DingID"),departmentID) |