c# - Return only specific child elements using IncludeRetElement Qbxml -


i using asp.net web service getting quickbook's data. request return sales order company file. here qbxml returned

<?xml version="1.0" ?> <qbxml> <qbxmlmsgsrs> <salesorderqueryrs requestid="whatever" statuscode="0" statusseverity="info" statusmessage="status ok"> <salesorderret> <timecreated>2013-08-27t16:33:27+05:00</timecreated> <customerref> <listid>80000033-1376329965</listid> <fullname>source design:q2633-atrium1-wigan</fullname> </customerref> <refnumber>5000</refnumber> </salesorderret> </salesorderqueryrs> </qbxmlmsgsrs> </qbxml> 

i returning few fields using includeretelement . problem want 3 fields i.e timecreated,fullname,refnumber. here c# code build request .

        string strrequestxml = "";         xmldocument inputxmldoc = null;         inputxmldoc = new xmldocument();         inputxmldoc.appendchild(inputxmldoc.createxmldeclaration("1.0", null, null));         inputxmldoc.appendchild(inputxmldoc.createprocessinginstruction("qbxml", "version=\"4.0\""));         xmlelement qbxml = inputxmldoc.createelement("qbxml");         inputxmldoc.appendchild(qbxml);         xmlelement qbxmlmsgsrq = inputxmldoc.createelement("qbxmlmsgsrq");         qbxml.appendchild(qbxmlmsgsrq);         qbxmlmsgsrq.setattribute("onerror", "stoponerror");         xmlelement salesqueryrq = inputxmldoc.createelement("salesorderqueryrq");         qbxmlmsgsrq.appendchild(salesqueryrq);         salesqueryrq.setattribute("requestid", "whatever");         xmlelement timecreated = inputxmldoc.createelement("includeretelement");         salesqueryrq.appendchild(timecreated).innertext = "timecreated";         xmlelement customerref = inputxmldoc.createelement("includeretelement");         salesqueryrq.appendchild(customerref).innertext = "customerref";         xmlelement templateref = inputxmldoc.createelement("includeretelement");         salesqueryrq.appendchild(templateref).innertext = "refnumber";         strrequestxml = inputxmldoc.outerxml;         req.add(strrequestxml); 

how remove listid . tried add includeretelement customerref gives error.

 xmlelement fullname = inputxmldoc.createelement("includeretelement");  customerref.appendchild(fullname).innertext = "fullname"; 

error message received application via getlasterror(): error!

need doing wrong?

you have either return inside customerref, or not return customerref @ all.

quickbooks not support returning customerref/fullname, , not customerref/listid.

so request should like:

<includeretelement>customerref</includeretelement>

if need either customer listid or customer fullname.


Comments