Ejemplo n.º 1
0
        public string GetUserId(string accessToken, string code)
        {
            DingUserInfoDto user = Get.GetJson <DingUserInfoDto>(string.Format("https://oapi.dingtalk.com/user/getuserinfo?access_token={0}&code={1}", accessToken, code));

            Logger.InfoFormat("Userid response errmsg:{0} body:{1}", user.errmsg, user.userid);
            return(user.userid);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取用户Id
        /// </summary>
        public string GetUserId(string accessToken, string code)
        {
            /*DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/getuserinfo");
             * OapiUserGetuserinfoRequest request = new OapiUserGetuserinfoRequest();
             * request.Code = code;
             * request.SetHttpMethod("GET");
             * OapiUserGetuserinfoResponse response = client.Execute(request, accessToken);
             * Logger.InfoFormat("Userid response errmsg:{0} body:{1}", response.Errmsg, response.Body);
             * return response.Userid;*/
            DingUserInfoDto user = Get.GetJson <DingUserInfoDto>(string.Format("https://oapi.dingtalk.com/user/getuserinfo?access_token={0}&code={1}", accessToken, code));

            Logger.InfoFormat("Userid response errmsg:{0} body:{1}", user.errmsg, user.userid);
            return(user.userid);
        }