我是Quickbooks与C#集成的新手,我正在运行以下代码来请求具有特定时间范围的DepositQuery,如下所示:
string DepositQueryRq = @"<?xml version =""1.0"" encoding=""utf-8""?>
<?qbxml version=""2.0""?>
<QBXML>
<QBXMLMsgsRq onError = ""stopOnError"">
<DepositQueryRq requestID = ""[reqID]"" />
<TxnDateRangeFilter>
<FromTxnDate>2018-03-14</FromTxnDate>
</TxnDateRangeFilter>
</QBXMLMsgsRq>
</QBXML>".Replace("[reqID]", Guid.NewGuid().ToString("B"));
string res = RequestHandler.Process(DepositQueryRq);
并返回以下消息: 解析提供的XML文本流时,QuickBooks发现错误。
我正在运行相同的查询,但没有Date说明符,它返回所有Desposits的列表
string DepositQueryRq = @"<?xml version =""1.0"" encoding=""utf-8""?>
<?qbxml version=""2.0""?>
<QBXML>
<QBXMLMsgsRq onError = ""stopOnError"">
<DepositQueryRq requestID = ""[reqID]"" />
</QBXMLMsgsRq>
</QBXML>".Replace("[reqID]", Guid.NewGuid().ToString("B"));
string res = RequestHandler.Process(DepositQueryRq);
答案 0 :(得分:0)
解决方案是在查询体中添加TimeFilter,如下所示:
string DepositQueryRq = @"<?xml version =""1.0"" encoding=""utf-8""?>
<?qbxml version=""2.0""?>
<QBXML>
<QBXMLMsgsRq onError = ""stopOnError"">
<DepositQueryRq requestID = ""[reqID]"">
<TxnDateRangeFilter>
<FromTxnDate>2018-03-14</FromTxnDate>
<ToTxnDate>2018-03-28</ToTxnDate>
</TxnDateRangeFilter>
</DepositQueryRq>
</QBXMLMsgsRq>
</QBXML>".Replace("[reqID]", Guid.NewGuid().ToString("B"));
OR
string DepositQueryRq = @"<?xml version =""1.0"" encoding=""utf-8""?>
<?qbxml version=""2.0""?>
<QBXML>
<QBXMLMsgsRq onError = ""stopOnError"">
<DepositQueryRq requestID = ""[reqID]"">
<ModifiedDateRangeFilter>
<FromModifiedDate>2018-03-13T10</FromModifiedDate>
<ToModifiedDate>2018-03-28T5</ToModifiedDate>
</ModifiedDateRangeFilter>
</DepositQueryRq>
</QBXMLMsgsRq>
</QBXML>".Replace("[reqID]", Guid.NewGuid().ToString("B"));