嘿伙计们我是这个 sdk 的新手我正在尝试添加 TODO 一切都很好直到我尝试指定时间或优先级或类型它给我错误 “QuickBooks 在解析提供的 XML 文本流时发现错误” 我正在使用 SDK 13 谁能帮帮我 谢谢
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using QBFC13Lib;
using System.Globalization;
using System.Windows.Forms;
namespace testing
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager sessionManager = null;
try
{
sessionManager = new QBSessionManager();
//Create the message set request object to hold our request
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
//Connect to QuickBooks and begin a session
sessionManager.OpenConnection("", "QuickBook Account Import");
connectionOpen = true;
sessionManager.BeginSession("C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files\\***.qbw", ENOpenMode.omDontCare);
sessionBegun = true;
IToDoAdd ToDoAddRq = requestMsgSet.AppendToDoAddRq();
ToDoAddRq.ReminderDate.SetValue(DateTime.ParseExact("29/4/2014", "d/M/yyyy", CultureInfo.InvariantCulture));
//Set field value for Time
ToDoAddRq.ReminderTime.SetValue(10, 10, 10, false);
//Set field value for Notes
ToDoAddRq.Notes.SetValue("abc");
//Set field value for IsActive
ToDoAddRq.IsActive.SetValue(true);
//Set field value for Type
ToDoAddRq.Type_2.SetValue(ENType.tCall);
//Set field value for Priority
ToDoAddRq.Priority.SetValue(ENPriority.pLow);
//Send the request and get the response from QuickBooks
sessionManager.DoRequests(requestMsgSet);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
}
finally
{
//End the session and close the connection to QuickBooks
if (sessionBegun)
{
sessionManager.EndSession();
}
if (connectionOpen)
{
sessionManager.CloseConnection();
}
}
}
}
}
最佳答案
QuickBooks qbXML API 是一个版本化 API。不同版本的 QuickBooks 将通过不同版本的 qbXML 规范支持不同的功能。
在开发时,您需要确保您使用的 qbXML API 版本既支持您需要的功能,又支持您的 QuickBooks 版本。
您当前使用的是 qbXML 版本 8.0
:
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);
通常,QuickBooks 版本与支持的 qbXML 版本相差 1。例如QuickBooks 14 支持 qbXML 版本 13。QuickBooks 13 支持 qbXML 版本 12 等。这意味着您现在的目标是 QuickBooks 2009。
您收到一条错误消息是因为,如果您引用 Intuit's docs , ToDoAdd
的 Type
和 Priority
标签仅在 13.0
及更高版本中受支持。您需要不在请求中包含这些值,或者使用更高版本的 qbXML API。
关于c# - Quickbooks SDK 13.0 ToDoAddRq C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23343880/