Ejemplo n.º 1
0
        /// <summary>
        /// 获取通讯录权限范围
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static ResponseParameters GetTheRangeOfAddressBookPermissions()
        {
            try
            {
                DefaultDingTalkClient client  = new DefaultDingTalkClient("https://oapi.dingtalk.com/auth/scopes");
                OapiAuthScopesRequest request = new OapiAuthScopesRequest();
                request.SetHttpMethod("GET");
                OapiAuthScopesResponse response = client.Execute(request, Get_Access_Token());

                return(new ResponseParameters()
                {
                    ErroCode = response.Errcode,
                    ErroMsg = response.Errmsg,
                    AuthUserField = response.AuthUserField,
                    ConditionField = response.ConditionField,
                    AuthedDept = response.AuthOrgScopes.AuthedDept,
                    AuthedUser = response.AuthOrgScopes.AuthedUser
                });
            }
            catch (Exception ex)
            {
                return(new ResponseParameters()
                {
                    ErroCode = -1,
                    ErroMsg = ex.Message
                });
            }
        }
Ejemplo n.º 2
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);
        }