API v2 C# SDK Null Reference Exception

API v2 C# SDK Null Reference Exception

Hi,

I'm try to connect to Zoho API using C# Sdk. I was following the steps in official documentation and I'm getting Null Reference Exception.

Here is a sample code:

  1. var config = new Dictionary<string, string>
  2.             {
  3.                 {"client_id", "..."},
  4.                 {"client_secret", "..."},
  5.                 {"redirect_uri", "https://localhost"},
  6.                 {"access_type", "offline"},
  7.                 {"persistence_handler_class", "ZCRMSDK.OAuth.ClientApp.ZohoOAuthFilePersistence, ZCRMSDK"},
  8.                 {
  9.                     "oauth_tokens_file_path",
  10.                     @"c:\zoho-tokens.txt"
  11.                 },
  12.                 {"mysql_username", ""},
  13.                 {"mysql_password", ""},
  14.                 {"mysql_database", ""},
  15.                 {"mysql_server", ""},
  16.                 {"mysql_port", ""},
  17.                 {"apiBaseUrl", "https://www.zohoapis.com"},
  18.                 {"iamURL", "https://accounts.zoho.com"},
  19.                 {"photoUrl", "https://profile.zoho.com/api/v1/user/self/photo"},
  20.                 {"apiVersion", "v2"},
  21.                 {"logFilePath", @"c:\Logs\Zoho"},
  22.                 {"timeout", ""},
  23.                 {"minLogLevel", ""},
  24.                 {"domainSuffix", ""},
  25.                 {"currentUserEmail", "..."}
  26.             };
  27.             ZCRMRestClient.Initialize(config);
  28.             var leadsResponse = ZCRMRestClient.GetInstance().GetModule("Leads");

Null Reference Exception
Before I got this exception i had a few exceptions saying something like: "Given user is not presented ...".

Any idea what can be wrong with it?

Thanks,
Maxat.