Quickbooks SDK 13.0 ToDoAddRq C#

本秂侑毒 提交于 2019-12-11 11:43:22

问题


hey guys i'm new to this sdk i'm trying to add TODO every thing is fine till i'm trying to specify time or Priority or type it is giving me error "QuickBooks found an error when parsing the provided XML text stream" i'm using SDK 13 can any one help me please thank you

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();
            }
        }
    }
}
}

回答1:


The QuickBooks qbXML API is a versioned API. Different versions of QuickBooks will support different functionality via different versions of the qbXML spec.

When developing, you need to make sure you're using a version of the qbXML API that both supports the functionality you need, and that your version of QuickBooks supports.

You are currently using qbXML version 8.0:

 IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);

Typically, QuickBooks versions are 1 off from the qbXML version supports. e.g. QuickBooks 14 supports qbXML version 13. QuickBooks 13 supports qbXML version 12. etc. That means that right now you're targeting QuickBooks 2009.

You're getting an error message because, if you refer to Intuit's docs, ToDoAdds Type and Priority tags are only supported in version 13.0 and higher. You need to either not include those values in your request, or use a higher qbXML API version.



来源:https://stackoverflow.com/questions/23343880/quickbooks-sdk-13-0-todoaddrq-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!