/// <summary> /// 获取部门详情 /// </summary> /// <param name="id"></param> /// <returns></returns> public static GetDepartment Get(string id) { AccessToken accessToken = TokenHelp.GetAccessToken(); string url = DingTalkUrlHelp.GetDepartment(accessToken.Value, id); GetDepartment model = new GetDepartment(); model = DingTalkHttpHelp <GetDepartment> .Get(url); return(model); }
/// <summary> /// 获取管理员列表 /// </summary> /// <returns></returns> public static Result GetByDepartmentIdForAdmin() { Result model = new Result(); AccessToken accessToken = TokenHelp.GetAccessToken(); string url = DingTalkUrlHelp.GetByDepartmentIdForAdmin(accessToken.Value); model = DingTalkHttpHelp <Result> .Get(url); return(model); }
/// <summary> /// 获取部门成员(详情) /// </summary> /// <param name="id"></param> /// <returns></returns> public static GetDepartmentForUserList GetByDepartmentIdForUserInfoList(string id) { GetDepartmentForUserList model = new GetDepartmentForUserList(); AccessToken accessToken = TokenHelp.GetAccessToken(); string url = DingTalkUrlHelp.GetByDepartmentIdForUserInfoList(accessToken.Value, id); model = DingTalkHttpHelp <GetDepartmentForUserList> .Get(url); return(model); }
/// <summary> /// 获取部门成员 /// </summary> /// <param name="id"></param> /// <returns></returns> public static ByDepIdFroSimpleListResult GetByDepartmentIdForSimpleList(string id) { ByDepIdFroSimpleListResult model = new ByDepIdFroSimpleListResult(); AccessToken accessToken = TokenHelp.GetAccessToken(); string url = DingTalkUrlHelp.GetByDepartmentIdForSimpleList(accessToken.Value, id); model = DingTalkHttpHelp <ByDepIdFroSimpleListResult> .Get(url); return(model); }
/// <summary> /// 删除 /// </summary> /// <param name="id"></param> /// <returns></returns> public static Result Delete(string id) { Result model = new Result(); AccessToken accessToken = TokenHelp.GetAccessToken(); string url = DingTalkUrlHelp.DeleteDepartment(accessToken.Value, id); model = DingTalkHttpHelp <Result> .Get(url); return(model); }
public static Result Update(string param) { Result model = new Result(); AccessToken accessToken = TokenHelp.GetAccessToken(); string url = DingTalkUrlHelp.UpdateEmployee(accessToken.Value); model = DingTalkHttpHelp <Result> .Post(url, param); if (model.errmsg == "40014") { accessToken = TokenHelp.GetAccessToken(); url = DingTalkUrlHelp.UpdateEmployee(accessToken.Value); model = DingTalkHttpHelp <Result> .Post(url, param); } return(model); }
public static string RegisterDingTalkCallBack() { RegisterModel regModel = new RegisterModel(); AccessToken token = TokenHelp.GetAccessToken(); string RegisterCallBackUrl = DingTalkUrlHelp.GetRegisterCallBack(token.Value); regModel.call_back_tag = new List <string>() { "user_leave_org" }; regModel.token = "加解密需要用到的token,ISV(服务提供商)推荐使用注册套件时填写的token,普通企业可以随机填写"; regModel.aes_key = "数据加密密钥。用于回调数据的加密,长度固定为43个字符,从a-z, A-Z, 0-9共62个字符中选取,您可以随机生成,ISV(服务提供商)推荐使用注册套件时填写的EncodingAESKey"; regModel.url = "钉钉中设置的接收事件回调的url"; string res = HttpHelper.Post(RegisterCallBackUrl, JsonConvert.SerializeObject(regModel, Formatting.Indented), "application/json").Html; return(res); }