示例#1
0
        public static string GetAccessToken()
        {
            string value = CacheHelper.GetCache <string>(AccessTokenKey);

            if (!string.IsNullOrEmpty(value))
            {
                return(value);
            }
            //测试
            //"ding4uxjomils4jwiiap"
            //"7X-k8WA5D3cPdktnbkot_jPxW7FvstBZ4NITsJBI7EdT6c8BgUVBAyI3oAUWfqnV"
            //正式
            //"dingnzjnupiizxh0tbys"
            //"_tnoyOl07vNpPtuEJJVfWulcTcO0mOky7MVFyLjeTmhsIpHyoDXlHqOufnZyK8Up"

            IDingTalkClient     client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
            OapiGettokenRequest request = new OapiGettokenRequest
            {
                Appkey    = "", // ConfigurationManager.AppSettings["DingTalkAppKey"],
                Appsecret = ""  // ConfigurationManager.AppSettings["DingTalkAppSecret"]
            };

            request.SetHttpMethod("Get");
            OapiGettokenResponse response = client.Execute(request);

            value = response.AccessToken;
            CacheHelper.SetCache(AccessTokenKey, value, 7200);
            return(value);
        }
示例#2
0
        /// <summary>
        /// 更新部门
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="id">部门id</param>
        /// <param name="lang">通讯录语言(默认zh_CN另外支持en_US)</param>
        /// <param name="name">部门名称,长度限制为1~64个字符,不允许包含字符‘-’‘,’以及‘,’</param>
        /// <param name="parentId">父部门id,根部门id为1</param>
        /// <param name="order">在父部门中的排序值,order值小的排序靠前</param>
        /// <param name="createDeptGroup">是否创建一个关联此部门的企业群</param>
        /// <param name="groupContainSubDept">部门群是否包含子部门</param>
        /// <param name="groupContainOuterDept">部门群是否包含外包部门</param>
        /// <param name="groupContainHiddenDept">部门群是否包含隐藏部门</param>
        /// <param name="autoAddUser">如果有新人加入部门是否会自动加入部门群</param>
        /// <param name="deptManagerUseridList">部门的主管列表,取值为由主管的userid组成的字符串,不同的userid使用“|”符号进行分割</param>
        /// <param name="deptHiding">是否隐藏部门, true表示隐藏 false表示显示</param>
        /// <param name="deptPermits">可以查看指定隐藏部门的其他部门列表,如果部门隐藏,则此值生效,取值为其他的部门id组成的的字符串,使用“|”符号进行分割。总数不能超过200</param>
        /// <param name="userPermits">可以查看指定隐藏部门的其他人员列表,如果部门隐藏,则此值生效,取值为其他的人员userid组成的字符串,使用“|”符号进行分割。总数不能超过200</param>
        /// <param name="outerDept">是否本部门的员工仅可见员工自己, 为true时,本部门员工默认只能看到员工自己</param>
        /// <param name="outerPermitDepts">本部门的员工仅可见员工自己为true时,可以配置额外可见部门,值为部门id组成的的字符串,使用|符号进行分割。总数不能超过200</param>
        /// <param name="outerPermitUsers">本部门的员工仅可见员工自己为true时,可以配置额外可见人员,值为userid组成的的字符串,使用|符号进行分割。总数不能超过200</param>
        /// <param name="outerDeptOnlySelf">outerDept为true时,可以配置该字段,为true时,表示只能看到所在部门及下级部门通讯录</param>
        /// <param name="orgDeptOwner">企业群群主</param>
        /// <param name="sourceIdentifier">部门标识字段,开发者可用该字段来唯一标识一个部门,并与钉钉外部通讯录里的部门做映射</param>
        /// <returns></returns>
        public OapiDepartmentUpdateResponse Update(string accessToken, long id, string lang = "zh_CN", string name = "", string parentId = "", string order = "", bool createDeptGroup = false, bool groupContainSubDept = false, bool groupContainOuterDept = false, bool groupContainHiddenDept = false, bool autoAddUser = false, string deptManagerUseridList = "", bool deptHiding = false, string deptPermits = "", string userPermits = "", bool outerDept = false, string outerPermitDepts = "", string outerPermitUsers = "", bool outerDeptOnlySelf = false, string orgDeptOwner = "", string sourceIdentifier = "")
        {
            IDingTalkClient             client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/department/update");
            OapiDepartmentUpdateRequest request = new OapiDepartmentUpdateRequest();

            request.Id                     = id;
            request.Lang                   = lang;
            request.Name                   = name;
            request.Parentid               = parentId;
            request.Order                  = order;
            request.CreateDeptGroup        = createDeptGroup;
            request.GroupContainSubDept    = groupContainSubDept;
            request.GroupContainOuterDept  = groupContainOuterDept;
            request.GroupContainHiddenDept = groupContainHiddenDept;
            request.AutoAddUser            = autoAddUser;
            request.DeptManagerUseridList  = deptManagerUseridList;
            request.DeptHiding             = deptHiding;
            request.DeptPermits            = deptPermits;
            request.UserPermits            = userPermits;
            request.OuterDept              = outerDept;
            request.OuterPermitDepts       = outerPermitDepts;
            request.OuterPermitUsers       = outerPermitUsers;
            request.OuterDeptOnlySelf      = outerDeptOnlySelf;
            request.OrgDeptOwner           = orgDeptOwner;
            request.SourceIdentifier       = sourceIdentifier;
            OapiDepartmentUpdateResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#3
0
        /// <summary>
        /// 发起审批实例
        /// </summary>
        /// <param name="accessToken">accessToken</param>
        /// <param name="agentId">企业应用标识(ISV调用必须设置)</param>
        /// <param name="processCode">审批流的唯一码,process_code就在审批流编辑的页面URL中</param>
        /// <param name="approvers">审批人userid列表,最大列表长度:20。多个审批人用逗号分隔,按传入的顺序依次审批</param>
        /// <param name="originatorUserID">审批实例发起人的userid</param>
        /// <param name="deptId">发起人所在的部门,如果发起人属于根部门,传-1</param>
        /// <param name="ccList">抄送人userid列表,最大列表长度:20。多个抄送人用逗号分隔</param>
        /// <param name="ccPosition">抄送时间,分为(START, FINISH, START_FINISH)</param>
        /// <param name="name">表单每一栏的名称</param>
        /// <param name="value">表单每一栏的值</param>
        /// <returns></returns>
        public OapiProcessinstanceCreateResponse Create(string accessToken, string processCode, string originatorUserID, long deptId, string name, string value, long?agentId = 0, string approvers = "", string ccList = "", string ccPosition = "")
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/processinstance/create");
            OapiProcessinstanceCreateRequest request = new OapiProcessinstanceCreateRequest
            {
                AgentId          = 0,
                ProcessCode      = processCode,
                Approvers        = approvers,
                OriginatorUserId = originatorUserID,
                DeptId           = deptId,
                CcList           = ccList,
                CcPosition       = ccPosition
            };
            List <FormComponentValueVoDomain> formComponentValues = new List <FormComponentValueVoDomain>();
            FormComponentValueVoDomain        vo = new FormComponentValueVoDomain
            {
                Name  = name,
                Value = value
            };

            formComponentValues.Add(vo);
            request.FormComponentValues_ = formComponentValues;
            OapiProcessinstanceCreateResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#4
0
        /// <summary>
        /// 获取应用列表
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public OapiMicroappListResponse List(string accessToken)
        {
            IDingTalkClient          client   = new DefaultDingTalkClient("https://oapi.dingtalk.com/microapp/list");
            OapiMicroappListRequest  req      = new OapiMicroappListRequest();
            OapiMicroappListResponse response = client.Execute(req, accessToken);

            return(response);
        }
示例#5
0
        /// <summary>
        /// 获取离职员工离职信息 根据员工userid列表,批量查询员工的离职信息。传入非离职员工userid,不会返回信息。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="userids">员工userid列表,最大长度50</param>
        /// <returns></returns>
        public OapiSmartworkHrmEmployeeListdimissionResponse ListDimission(string accessToken, string userids)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/listdimission");
            OapiSmartworkHrmEmployeeListdimissionRequest req = new OapiSmartworkHrmEmployeeListdimissionRequest();

            req.UseridList = userids;
            OapiSmartworkHrmEmployeeListdimissionResponse response = client.Execute(req, accessToken);

            return(response);
        }
示例#6
0
        /// <summary>
        /// 服务端通过临时授权码获取授权用户的个人信息
        /// </summary>
        /// <param name="tmpAuthCode">用户授权的临时授权码code,只能使用一次;在前面步骤中跳转到redirect_uri时会追加code参数</param>
        /// <param name="appId"></param>
        /// <param name="secret"></param>
        /// <returns></returns>
        public OapiSnsGetuserinfoBycodeResponse GetUserInfoByCode(string tmpAuthCode, string appId, string secret)
        {
            DefaultDingTalkClient           client = new DefaultDingTalkClient("https://oapi.dingtalk.com/sns/getuserinfo_bycode");
            OapiSnsGetuserinfoBycodeRequest req    = new OapiSnsGetuserinfoBycodeRequest();

            req.TmpAuthCode = tmpAuthCode;
            OapiSnsGetuserinfoBycodeResponse response = client.Execute(req, appId, secret);

            return(response);
        }
示例#7
0
        /// <summary>
        /// 获取角色详情
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="roleId">角色Id</param>
        /// <returns></returns>
        public OapiRoleGetroleResponse GetRole(string accessToken, long roleId)
        {
            IDingTalkClient        client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/role/getrole");
            OapiRoleGetroleRequest req    = new OapiRoleGetroleRequest();

            req.RoleId = roleId;
            OapiRoleGetroleResponse rsp = client.Execute(req, accessToken);

            return(rsp);
        }
示例#8
0
        /// <summary>
        /// 获取用户考勤组 在钉钉考勤应用中,考勤组是一类具有相同的班次、考勤位置等考勤规则的人或部门的组合,一个企业中的一个人只能属于一个考勤组。如果您的企业使用了钉钉考勤并希望获取员工的考勤组信息,可选择使用此接口。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="userId">员工在企业内的UserID,企业用来唯一标识用户的字段</param>
        /// <returns></returns>
        public OapiAttendanceGetusergroupResponse GetUserGroup(string accessToken, string userId)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/attendance/getusergroup");
            OapiAttendanceGetusergroupRequest request = new OapiAttendanceGetusergroupRequest();

            request.Userid = userId;
            OapiAttendanceGetusergroupResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#9
0
        /// <summary>
        /// 创建角色组
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="name">角色组名称</param>
        /// <returns></returns>
        public OapiRoleAddrolegroupResponse AddRoleGroup(string accessToken, string name)
        {
            IDingTalkClient             client = new DefaultDingTalkClient("https://oapi.dingtalk.com/role/add_role_group");
            OapiRoleAddrolegroupRequest req    = new OapiRoleAddrolegroupRequest();

            req.Name = name;
            OapiRoleAddrolegroupResponse response = client.Execute(req, accessToken);

            return(response);
        }
示例#10
0
        /// <summary>
        /// 删除角色 【注意】删除角色前,需确保角色下面的员工没有被赋予这个角色
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="roleId">角色id</param>
        /// <returns></returns>
        public OapiRoleDeleteroleResponse DeleteRole(string accessToken, long roleId)
        {
            IDingTalkClient           client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/role/deleterole");
            OapiRoleDeleteroleRequest request = new OapiRoleDeleteroleRequest();

            request.RoleId = roleId;
            OapiRoleDeleteroleResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#11
0
        /// <summary>
        /// 获取外部联系人详情
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        public OapiExtcontactGetResponse Get(string accessToken, string userId)
        {
            IDingTalkClient          client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/extcontact/get");
            OapiExtcontactGetRequest request = new OapiExtcontactGetRequest();

            request.UserId = userId;
            OapiExtcontactGetResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#12
0
        /// <summary>
        /// 获取管理员通讯录权限范围
        /// </summary>
        /// <param name="accessToken">accessToken</param>
        /// <param name="userId">员工id</param>
        /// <returns></returns>
        public OapiUserGetAdminScopeResponse GetAdminScope(string accessToken, string userId)
        {
            IDingTalkClient client           = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/user/get_admin_scope");
            OapiUserGetAdminScopeRequest req = new OapiUserGetAdminScopeRequest();

            req.Userid = userId;
            OapiUserGetAdminScopeResponse rsp = client.Execute(req, accessToken);

            return(rsp);
        }
示例#13
0
        /// <summary>
        /// 获取管理员列表
        /// </summary>
        /// <param name="accessToken">accessToken</param>
        /// <returns></returns>
        public OapiUserGetAdminResponse GetAdmin(string accessToken)
        {
            IDingTalkClient         client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/get_admin");
            OapiUserGetAdminRequest request = new OapiUserGetAdminRequest();

            request.SetHttpMethod("GET");
            OapiUserGetAdminResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#14
0
        /// <summary>
        /// 获取应用的可见范围
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="agentId">需要查询的应用实例化agentId</param>
        /// <returns></returns>
        public OapiMicroappVisibleScopesResponse VisibleScopes(string accessToken, long agentId)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/microapp/visible_scopes");
            OapiMicroappVisibleScopesRequest req = new OapiMicroappVisibleScopesRequest();

            req.AgentId = agentId;
            OapiMicroappVisibleScopesResponse response = client.Execute(req, accessToken);

            return(response);
        }
示例#15
0
        /// <summary>
        /// 获取角色组
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="groupId">角色组的Id</param>
        public OapiRoleGetrolegroupResponse GetRoleGroup(string accessToken, long groupId)
        {
            IDingTalkClient             client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/role/getrolegroup");
            OapiRoleGetrolegroupRequest request = new OapiRoleGetrolegroupRequest();

            request.GroupId = groupId;
            OapiRoleGetrolegroupResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#16
0
        /// <summary>
        /// 获取用户待审批数量
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        public OapiProcessGettodonumResponse GetTodonum(string accessToken, string userId)
        {
            IDingTalkClient client           = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/process/gettodonum");
            OapiProcessGettodonumRequest req = new OapiProcessGettodonumRequest();

            req.Userid = userId;
            OapiProcessGettodonumResponse response = client.Execute(req, accessToken);

            return(response);
        }
示例#17
0
        /// <summary>
        /// 获取审批实例详情 根据审批实例id调用此接口获取审批实例详情,包括审批表单信息、操作记录列表、操作人、抄送人、审批任务列表等。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="processInstanceId">审批实例id</param>
        /// <returns></returns>
        public OapiProcessinstanceGetResponse Get(string accessToken, string processInstanceId)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/processinstance/get");
            OapiProcessinstanceGetRequest request = new OapiProcessinstanceGetRequest();

            request.ProcessInstanceId = processInstanceId;
            OapiProcessinstanceGetResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#18
0
        /// <summary>
        /// 获取用户公告数据 企业使用此接口可获取指定人员的公告情况,在企业自定义工作首页进行公告轮播展示。列出用户当前有权限看到的10条公告。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        public OapiBlackboardListtoptenResponse ListTopten(string accessToken, string userId)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/blackboard/listtopten");
            OapiBlackboardListtoptenRequest request = new OapiBlackboardListtoptenRequest();

            request.Userid = userId;
            OapiBlackboardListtoptenResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#19
0
        /// <summary>
        /// 通讯录权限范围
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public OapiAuthScopesResponse Scopes(string accessToken)
        {
            IDingTalkClient       client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/auth/scopes");
            OapiAuthScopesRequest request = new OapiAuthScopesRequest();

            request.SetHttpMethod("GET");
            OapiAuthScopesResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#20
0
        /// <summary>
        /// 获取用户钉钉运动开启状态 企业使用此接口可查询用户是否启用了钉钉运动,如果未开启,不会参与企业的钉钉运动排名。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        public OapiHealthStepinfoGetuserstatusResponse GetUserStatus(string accessToken, string userId)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/health/stepinfo/getuserstatus");
            OapiHealthStepinfoGetuserstatusRequest request = new OapiHealthStepinfoGetuserstatusRequest();

            request.Userid = userId;
            OapiHealthStepinfoGetuserstatusResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#21
0
        /// <summary>
        /// 批量获取钉钉运动数据 在钉钉运动中,每天会对员工运动步数统计和排名,如果企业想更灵活的定制统计规则,比如按月、按部门等维度,可使用此接口。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="userIds">员工userid列表,最多传50个</param>
        /// <param name="statDate">时间,注意时间格式是YYMMDD</param>
        /// <returns></returns>
        public OapiHealthStepinfoListbyuseridResponse ListByUserID(string accessToken, string userIds, string statDate)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/health/stepinfo/listbyuserid");
            OapiHealthStepinfoListbyuseridRequest request = new OapiHealthStepinfoListbyuseridRequest();

            request.Userids  = userIds;
            request.StatDate = statDate;
            OapiHealthStepinfoListbyuseridResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#22
0
 /// <summary>
 /// 获取用户可见的日志模板
 /// </summary>
 /// <param name="accessToken">accessToken</param>
 /// <param name="offSet">分页游标,从0开始。根据返回结果里的next_cursor是否为空来判断是否还有下一页,且再次调用时offset设置成next_cursor的值</param>
 /// <param name="size">分页大小,最大可设置成100</param>
 /// <param name="userId">用户id</param>
 public void ListTemplateByUserId(string accessToken, long offSet, long size, string userId = "")
 {
     IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/report/template/listbyuserid");
     OapiReportTemplateListbyuseridRequest req = new OapiReportTemplateListbyuseridRequest()
     {
         Userid = userId,
         Offset = offSet,
         Size   = size
     };
     OapiReportTemplateListbyuseridResponse rsp = client.Execute(req, accessToken);
 }
示例#23
0
        /// <summary>
        /// 获取用户日志未读数
        /// </summary>
        /// <param name="accessToken">accessToken</param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        public OapiReportGetunreadcountResponse GetUnReadCount(string accessToken, string userId)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/report/getunreadcount");
            OapiReportGetunreadcountRequest request = new OapiReportGetunreadcountRequest
            {
                Userid = userId
            };
            OapiReportGetunreadcountResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#24
0
        /// <summary>
        /// 获取日志统计数据
        /// </summary>
        /// <param name="accessToken">accessToken</param>
        /// <param name="reportId">日志id</param>
        /// <returns></returns>
        public OapiReportStatisticsResponse Statistics(string accessToken, string reportId)
        {
            IDingTalkClient             client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/report/statistics");
            OapiReportStatisticsRequest req    = new OapiReportStatisticsRequest
            {
                ReportId = reportId
            };
            OapiReportStatisticsResponse rsp = client.Execute(req, accessToken);

            return(rsp);
        }
示例#25
0
        /// <summary>
        /// 更新待办 企业可以调用该接口更新待办事项状态,调用成功后,该待办事项在该用户的“待办事项”列表页面中消失。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="userId">待办事项对应的用户id</param>
        /// <param name="recordId">待办事项唯一id</param>
        /// <returns></returns>
        public OapiWorkrecordUpdateResponse UploadWorkRecord(string accessToken, string userId, string recordId)
        {
            IDingTalkClient             client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/workrecord/update");
            OapiWorkrecordUpdateRequest req    = new OapiWorkrecordUpdateRequest();

            req.Userid   = userId;
            req.RecordId = recordId;
            OapiWorkrecordUpdateResponse rsp = client.Execute(req, accessToken);

            return(rsp);
        }
示例#26
0
        /// <summary>
        /// 上传媒体文件 用于上传图片、语音媒体资源文件以及普通文件(如doc、ppt),接口返回媒体资源标识media_id。请注意:media_id是可复用的,同一个media_id多次使用。 media_id对应的资源文件,仅能在钉钉客户端内使用。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="type">媒体文件类型,分别有图片(image)、语音(voice)、普通文件(file)</param>
        /// <param name="media">form-data中媒体文件标识,有filename、filelength、content-type等信息</param>
        /// <returns></returns>
        public OapiMediaUploadResponse Upload(string accessToken, string type, FileItem media)
        {
            IDingTalkClient        client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/media/upload");
            OapiMediaUploadRequest request = new OapiMediaUploadRequest();

            request.Type  = type;
            request.Media = media;
            OapiMediaUploadResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#27
0
        /// <summary>
        /// 发送群消息
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="chatId">群会话的id,可以在调用创建群会话接口的返回结果里面获取,也可以通过dd.chooseChat获取</param>
        /// <param name="msg">消息内容,消息类型和样例可参考“消息类型与数据格式”文档 https://open-doc.dingtalk.com/microapp/serverapi2/ye8tup</param>
        /// <returns></returns>
        public OapiChatSendResponse Send(string accessToken, string chatId, MsgDomain msg)
        {
            IDingTalkClient     client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/chat/send");
            OapiChatSendRequest request = new OapiChatSendRequest();

            request.Chatid = chatId;
            request.Msg_   = msg;
            OapiChatSendResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#28
0
        /// <summary>
        /// 获取会话
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="chatId">群会话的id</param>
        /// <returns></returns>
        public OapiChatGetResponse Get(string accessToken, string chatId)
        {
            IDingTalkClient    client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/chat/get");
            OapiChatGetRequest request = new OapiChatGetRequest();

            request.SetHttpMethod("GET");
            request.Chatid = chatId;
            OapiChatGetResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#29
0
        /// <summary>
        /// 工作通知消息撤回
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="agentId">微应用的agentid</param>
        /// <param name="taskId">异步任务的id</param>
        /// <returns></returns>
        public OapiMessageCorpconversationRecallResponse Recall(string accessToken, long agentId = 0, long taskId = 0)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/recall");
            OapiMessageCorpconversationRecallRequest request = new OapiMessageCorpconversationRecallRequest();

            request.AgentId   = agentId;
            request.MsgTaskId = taskId;
            OapiMessageCorpconversationRecallResponse response = client.Execute(request, accessToken);

            return(response);
        }
示例#30
0
        /// <summary>
        /// 企业考勤组详情 在钉钉考勤应用中,考勤组是一类具有相同的班次、考勤位置等考勤规则的人或部门的组合,企业可根据实际业务设置多个考勤组。如果企业想获取企业的考勤组与企业业务系统对接,可使用此接口查询所有的考勤组详情信息。
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="offset">偏移位置,从0、1、2...依次递增,默认值:0</param>
        /// <param name="size">分页大小,最大10,默认值:10</param>
        /// <returns></returns>
        public OapiAttendanceGetsimplegroupsResponse GetSimpleGroup(string accessToken, long offset = 0, long size = 10)
        {
            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/attendance/getsimplegroups");
            OapiAttendanceGetsimplegroupsRequest request = new OapiAttendanceGetsimplegroupsRequest();

            request.Offset = offset;
            request.Size   = size;
            OapiAttendanceGetsimplegroupsResponse execute = client.Execute(request, accessToken);

            return(execute);
        }