コード例 #1
0
        public bool Connect()
        {
            try
            {
                ZCRMRestClient.Initialize(new Dictionary <string, string>
                {
                    { "client_id", Configuration["zoho:client_id"] },
                    { "client_secret", Configuration["zoho:client_secret"] },
                    { "redirect_uri", Configuration["zoho:redirect_uri"] },
                    { "currentUserEmail", Configuration["zoho:email"] },
                    { "persistence_handler_class", "ZCRMSDK.OAuth.ClientApp.ZohoOAuthInMemoryPersistence, ZCRMSDK" },
                });
                ZohoOAuthClient.Initialize();

                var authClient = ZohoOAuthClient.GetInstance();
                var tokens     = authClient.GenerateAccessTokenFromRefreshToken(
                    Configuration["zoho:refresh_token"],
                    Configuration["zoho:email"]);

                ZohoCRMClient = ZCRMRestClient.GetInstance();

                LeadsModule = ZohoCRMClient.GetModuleInstance("Leads");
                Connected   = true;
            }
            catch (ZCRMException ex)
            {
                Console.WriteLine("Unable to initialize CRM Connection");
                Error = true;
            }

            return(Connected);
        }
コード例 #2
0
ファイル: ZohoController.cs プロジェクト: iean/ZohoCRMNETCore
 public List <ZCRMModule> modules()
 {
     try
     {
         this.AuthorizeZoho();
         ZCRMRestClient restClient             = ZCRMRestClient.GetInstance();
         BulkAPIResponse <ZCRMModule> response = restClient.GetAllModules();
         List <ZCRMModule>            modules  = response.BulkData;// modules - list of ZCRMModule instances
         return(modules);
     }
     catch (Exception exception)
     {
         throw;
     }
 }