/// <summary> /// 删除部门 /// </summary> public DeptCommResult DeleteDept(string accessToken, Int64 id) { string urlFormat = "https://qyapi.weixin.qq.com/cgi-bin/department/delete?access_token={0}&id={1}"; var url = string.Format(urlFormat, accessToken, id); //post string resultMsg = HttpHelper.HttpGet(url, ""); //反序列化 DeptCommResult result = JsonConvert.DeserializeObject <DeptCommResult>(resultMsg); return(result); }
/// <summary> /// 更新部门 /// </summary> public DeptCommResult UpdateDept(string accessToken, Int64 id, string name) { string urlFormat = "https://qyapi.weixin.qq.com/cgi-bin/department/update?access_token={0}"; var DeptInfo = new { id = id, name = name }; var url = string.Format(urlFormat, accessToken); //序列化 string postData = JsonConvert.SerializeObject(DeptInfo); //post string resultMsg = HttpHelper.HttpPost(url, postData); //反序列化 DeptCommResult result = JsonConvert.DeserializeObject <DeptCommResult>(resultMsg); return(result); }