值不能为空。参数名称:key(Xero api .NET lib)

时间:2018-01-25 04:58:31

标签: xero-api

我收到错误"值不能为空。参数名称:key"在xapi.Items.Create(item1)行,使用Github Xero c#lib创建库存项目。可能有什么不对?

这是c#代码:

string xeroAPIUrl = "https://api.xero.com";
PrivateAuthenticator pAuth = new PrivateAuthenticator(@"..\publickey.cer");
Consumer consumer = new Consumer("............", ".................");
XeroCoreApi xapi = new XeroCoreApi(xeroAPIUrl, pAuth, consumer, null, new DefaultMapper(), new DefaultMapper());
Item item1 = new Item();
item1.Id = Guid.NewGuid();
item1.Code = "BTC";
item1.Name = "BITCOIN";
item1.Description = "Bitcoin Entry";
item1.PurchaseDescription = "Bitcoin Purchase";
item1.PurchaseDetails = new PurchaseDetails() { UnitPrice = 100.00m, 
AccountCode = "200" };
item1.SalesDetails = new SalesDetails() { UnitPrice = 110.00m, AccountCode = "300" };
item1 = xapi.Items.Create(item1);

此致

穆拉利

0 个答案:

没有答案