Exemplo n.º 1
0
        /// <summary>
        /// 邀请成员关注
        /// </summary>
        /// <param name="accessToken">企业的access_token</param>
        /// <param name="toUser">成员ID列表,多个接收者用‘|’分隔,最多支持1000个。</param>
        /// <param name="toParty">部门ID列表,多个接收者用‘|’分隔,最多支持100个。</param>
        /// <param name="toTag">标签ID列表,多个接收者用‘|’分隔。</param>
        /// <param name="inviteTips">推送到微信上的提示语(只有认证号可以使用)。当使用微信推送时,该字段默认为“请关注XXX企业号”,邮件邀请时,该字段无效。</param>
        /// <param name="callBack">回调信息。任务完成后,通过callback推送事件给企业。具体请参考应用回调模式中的相应选项</param>
        /// <param name="timeOut"></param>
        /// post数据格式:
        /// {
        ///     "touser":"******",
        ///     "toparty":"xxx|xxx",
        ///     "totag":"xxx|xxx",
        ///     "invite_tips":"xxx",
        ///     "callback":
        ///     {
        ///         "url": "xxx",
        ///         "token": "xxx",
        ///         "encodingaeskey": "xxx"
        ///     }
        /// }
        /// <returns></returns>
        public static AsynchronousJobId BatchInviteUser(string accessToken, string toUser, string toParty, string toTag, string inviteTips, Asynchronous_CallBack callBack, int timeOut = Config.TIME_OUT)
        {
            var url = "https://qyapi.weixin.qq.com/cgi-bin/batch/inviteuser?access_token={0}";

            var data = new
                {
                    touser = toUser,
                    toparty = toParty,
                    totag = toTag,
                    invite_tips = inviteTips,
                    callback = callBack
                };

            return CommonJsonSend.Send<AsynchronousJobId>(accessToken, url, data, CommonJsonSendType.POST, timeOut);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 全量覆盖部门
        /// CSV模板下载地址:http://qydev.weixin.qq.com/batch_party_sample.csv
        /// 注意事项:
        /// 1.文件中存在、通讯录中也存在的部门,执行修改操作
        /// 2.文件中存在、通讯录中不存在的部门,执行添加操作
        /// 3.文件中不存在、通讯录中存在的部门,当部门为空时,执行删除操作
        /// 4.CSV文件中,部门名称、部门ID、父部门ID为必填字段,部门ID必须为数字;排序为可选字段,置空或填0不修改排序
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="mediaId">上传的csv文件的media_id</param>
        /// <param name="callBack">回调信息。任务完成后,通过callback推送事件给企业。具体请参考应用回调模式中的相应选项</param>
        /// <param name="timeOut"></param>
        /// post数据格式:
        /// {
        ///    "media_id":"xxxxxx",
        ///    "callback":
        ///    {
        ///        "url": "xxx",
        ///        "token": "xxx",
        ///        "encodingaeskey": "xxx"
        ///    }
        /// }
        /// <returns></returns>
        public static AsynchronousJobId BatchReplaceParty(string accessToken, string mediaId, Asynchronous_CallBack callBack, int timeOut = Config.TIME_OUT)
        {
            var url = "https://qyapi.weixin.qq.com/cgi-bin/batch/replaceparty?access_token={0}";

            var data = new
            {
                media_id = mediaId,
                callback = callBack
            };

            return CommonJsonSend.Send<AsynchronousJobId>(accessToken, url, data, CommonJsonSendType.POST, timeOut);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 邀请成员关注
        /// </summary>
        /// <param name="accessToken">企业的access_token</param>
        /// <param name="toUser">成员ID列表,多个接收者用‘|’分隔,最多支持1000个。</param>
        /// <param name="toParty">部门ID列表,多个接收者用‘|’分隔,最多支持100个。</param>
        /// <param name="toTag">标签ID列表,多个接收者用‘|’分隔。</param>
        /// <param name="inviteTips">推送到微信上的提示语(只有认证号可以使用)。当使用微信推送时,该字段默认为“请关注XXX企业号”,邮件邀请时,该字段无效。</param>
        /// <param name="callBack">回调信息。任务完成后,通过callback推送事件给企业。具体请参考应用回调模式中的相应选项</param>
        /// <param name="timeOut"></param>
        /// post数据格式:
        /// {
        ///     "touser":"******",
        ///     "toparty":"xxx|xxx",
        ///     "totag":"xxx|xxx",
        ///     "invite_tips":"xxx",
        ///     "callback":
        ///     {
        ///         "url": "xxx",
        ///         "token": "xxx",
        ///         "encodingaeskey": "xxx"
        ///     }
        /// }
        /// <returns></returns>
        public static AsynchronousJobId BatchInviteUser(string accessToken, string toUser, string toParty, string toTag, string inviteTips, Asynchronous_CallBack callBack, int timeOut = Config.TIME_OUT)
        {
            var url = "https://qyapi.weixin.qq.com/cgi-bin/batch/inviteuser?access_token={0}";

            var data = new
            {
                touser      = toUser,
                toparty     = toParty,
                totag       = toTag,
                invite_tips = inviteTips,
                callback    = callBack
            };

            return(CommonJsonSend.Send <AsynchronousJobId>(accessToken, url, data, CommonJsonSendType.POST, timeOut));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 【异步方法】全量覆盖成员
        /// CSV模板下载地址:http://qydev.weixin.qq.com/batch_user_sample.csv
        /// 注意事项:
        /// 1.模板中的部门需填写部门ID,多个部门用分号分隔,部门ID必须为数字
        /// 2.文件中存在、通讯录中也存在的成员,完全以文件为准
        /// 3.文件中存在、通讯录中不存在的成员,执行添加操作
        /// 4.通讯录中存在、文件中不存在的成员,执行删除操作。出于安全考虑,如果需要删除的成员多于50人,且多于现有人数的20%以上,系统将中止导入并返回相应的错误码
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="mediaId">上传的csv文件的media_id</param>
        /// <param name="callBack">回调信息。任务完成后,通过callback推送事件给企业。具体请参考应用回调模式中的相应选项</param>
        /// <param name="timeOut"></param>
        /// post数据格式:
        /// {
        ///    "media_id":"xxxxxx",
        ///    "callback":
        ///    {
        ///        "url": "xxx",
        ///        "token": "xxx",
        ///        "encodingaeskey": "xxx"
        ///    }
        /// }
        /// <returns></returns>
        public static async Task<AsynchronousJobId> BatchReplaceUserAsync(string accessToken, string mediaId, Asynchronous_CallBack callBack, int timeOut = Config.TIME_OUT)
        {
            var url = "https://qyapi.weixin.qq.com/cgi-bin/batch/replaceuser?access_token={0}";

            var data = new
            {
                media_id = mediaId,
                callback = callBack
            };

            return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<AsynchronousJobId>(accessToken, url, data, CommonJsonSendType.POST, timeOut);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 全量覆盖部门
        /// CSV模板下载地址:http://qydev.weixin.qq.com/batch_party_sample.csv
        /// 注意事项:
        /// 1.文件中存在、通讯录中也存在的部门,执行修改操作
        /// 2.文件中存在、通讯录中不存在的部门,执行添加操作
        /// 3.文件中不存在、通讯录中存在的部门,当部门为空时,执行删除操作
        /// 4.CSV文件中,部门名称、部门ID、父部门ID为必填字段,部门ID必须为数字;排序为可选字段,置空或填0不修改排序
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="mediaId">上传的csv文件的media_id</param>
        /// <param name="callBack">回调信息。任务完成后,通过callback推送事件给企业。具体请参考应用回调模式中的相应选项</param>
        /// <param name="timeOut"></param>
        /// post数据格式:
        /// {
        ///    "media_id":"xxxxxx",
        ///    "callback":
        ///    {
        ///        "url": "xxx",
        ///        "token": "xxx",
        ///        "encodingaeskey": "xxx"
        ///    }
        /// }
        /// <returns></returns>
        public static AsynchronousJobId BatchReplaceParty(string accessToken, string mediaId, Asynchronous_CallBack callBack, int timeOut = Config.TIME_OUT)
        {
            var url = "https://qyapi.weixin.qq.com/cgi-bin/batch/replaceparty?access_token={0}";

            var data = new
            {
                media_id = mediaId,
                callback = callBack
            };

            return(CommonJsonSend.Send <AsynchronousJobId>(accessToken, url, data, CommonJsonSendType.POST, timeOut));
        }