然而,我曾经尝试这样做,现在我得到一个错误的请求。
var customers = IntuitServiceConfig.ServiceManager.FindAll<Customer>(new Customer(), 1, 100);
foreach (Intuit.Ipp.Data.Customer customer in customers)
{
Customer resultCustomer = IntuitServiceConfig.ServiceManager.FindById(customer) as Customer;
//Mandatory Fields
customer.Id = resultCustomer.Id;
customer.SyncToken = resultCustomer.SyncToken;
customer.GivenName = "Bob";
customer.Title = "Mr.";
customer.MiddleName = "Anto";
customer.FamilyName = "Bob";
Customer result = IntuitServiceConfig.ServiceManager.Update(customer) as Customer;
}
目前对于客户更新,其中不正确的命名空间导致请求错误出在DOTNET SDK中的错误。 我们正在研究这一点。 检查此变通办法:
创建一个新的客户对象和结果分配给它。 然后调用客户更新操作。 例如:
Customer found = GetQboCustomer();
Customer customerToUpdate = new Customer();
customerToUpdate.Id = found.Id;
customerToUpdate.SyncToken = found.SyncToken;
//Set Other Properties
//Perform Sparse Update
var customers = IntuitServiceConfig.ServiceManager.FindAll<Customer>(new Customer(), 1, 100);
foreach (Intuit.Ipp.Data.Customer customer in customers)
{
Customer resultCustomer = IntuitServiceConfig.ServiceManager.FindById(customer) as Customer;
//Mandatory Fields
resultCustomer.GivenName = "Bob";
resultCustomer.Title = "Mr.";
resultCustomer.MiddleName = "Anto";
resultCustomer.FamilyName = "Bob";
Customer result = IntuitServiceConfig.ServiceManager.Update(resultCustomer) as Customer;
}
你即将得到一些客户的名单,再由ID找到然后更新旧,这不会被罚款,u能做到像上面或者我认为最好的办法是下面。
var customers = IntuitServiceConfig.ServiceManager.FindAll<Customer>(new Customer(), 1, 100);
foreach (Intuit.Ipp.Data.Customer customer in customers)
{
//Mandatory Fields
customer.GivenName = "Bob";
customer.Title = "Mr.";
customer.MiddleName = "Anto";
customer.FamilyName = "Bob";
Customer result = IntuitServiceConfig.ServiceManager.Update(customer) as Customer;
}
你可以尝试捕捉与此相关的更新API调用原始请求和响应个XML。 参考- https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0150_ipp_.net_devkit_3.0/logging#Request_and_Response_Log
您也可以尝试创建客户更新有效载荷和使用Apiexplorer尝试更新的呼叫。 https://developer.intuit.com/apiexplorer?apiname=V3QBO#Customer
谢谢