Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Partner API creation returns XeroCoreApi error ''{object}.Organisation' threw an exception of ty

Started by Kim LeRoy -   in API Authentication

My code:
var partnerConsumer = new Consumer(consumerKey, consumerSecret);

var partnerAuthenticator = new PartnerMvcAuthenticator(baseApiUrl, baseApiUrl, callbackUrl,
memoryStore, signingCertificatePath,
partnerConsumer, requestTokenStore, signingCertificatePassword);

var partner_app_api = new XeroCoreApi(baseApiUrl, partnerAuthenticator, partnerConsumer, null, new DefaultMapper(), new DefaultMapper());


When I run through debugger,

partner_app_api.Organisation has the Value: 'partner_app_api.Organisation' threw an exception of type 'System.NullReferenceException'

but all other Endpoints appear as normal.

but if I then I run for example

var partner_contacts = partner_app_api.Contacts.Find().ToString();

I get an error:

$exception {"Object reference not set to an instance of an object."}

Any ideas?

Thanks in advance...