public JsonResult Register() { DDHelper DDHelper = new DDHelper(); //获取钉钉token string access_token = DDHelper.GetAccessToken(); //注册时填写的token、aes_key、suitekey string token = ConfigurationManager.AppSettings["SuiteToken"]; //token = "123456";//钉钉测试文档中的token string aes_key = ConfigurationManager.AppSettings["Suiteaes_key"]; //aes_key = "4g5j64qlyl3zvetqxz5jiocdr586fn2zvjpa8zls3ij";//钉钉测试文档中的aes_key //准备钉钉回调事件类型 //bpms_task_change : 审批任务开始,结束,转交 //bpms_instance_change:审批实例开始,结束 string data = "{\"call_back_tag\":[\"bpms_task_change\",\"bpms_instance_change\"],\"token\":\"" + token + "\",\"aes_key\":\"" + aes_key + "\",\"url\":\"http://***/Suite/Receive\"}"; string json = new DDHelper().Request("user/create?access_token=" + access_token, data, "POST"); return(Json(json)); }
/// <summary> /// 获取AccessToken /// 开发者在调用开放平台接口前需要通过CorpID和CorpSecret获取AccessToken。 /// </summary> /// <returns></returns> public string GetAccessToken() { return(DDHelper.GetAccessToken(CorpId, CorpSecret)); }