Trying to add Inventory Item (QBO) but properties are being ignored - intuit-partner-platform

I am using the IPP .NET SDK (ver 2.0.1.0), VS2013, and C#
My code to submit a new item is as follows (I've plugged in static data to verify).
var item = new Item()
{
Type = ItemTypeEnum.Inventory,
TrackQtyOnHand = true,
QtyOnHand = 12,
InvStartDate = DateTime.Today,
Active = true,
Name = "TEST0004",
Description = "Test Product",
PurchaseDesc = "Test Product",
Taxable = true,
SalesTaxIncluded = false,
IncomeAccountRef = new ReferenceType() { Value = "1" }, // SALES
ExpenseAccountRef = new ReferenceType() { Value = "50" }, // COGS
AssetAccountRef = new ReferenceType() { Value = "49" }, // Inventory Asset
UnitPrice = 10M,
PurchaseCost = 7.5M,
sparse = true
};
ServiceContext serviceContext = getServiceContext(profile);
var data = new DataService(serviceContext).Add<Item>(item);
My expectation is to havea new inventory item added with quantity tracking enabled. Below is the response I get when querying for this product using the API Explorer.
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-12-30T11:45:02.640-08:00">
<QueryResponse startPosition="1" maxResults="1">
<Item domain="QBO" sparse="false">
<Id>21</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-12-30T11:40:41-08:00</CreateTime>
<LastUpdatedTime>2013-12-30T11:40:41-08:00</LastUpdatedTime>
</MetaData>
<Name>TEST0004</Name>
<Description>Test Product</Description>
<Active>true</Active>
<FullyQualifiedName>TEST0004</FullyQualifiedName>
<Taxable>false</Taxable>
<UnitPrice>0</UnitPrice>
<Type>Service</Type>
<IncomeAccountRef name="Sales">1</IncomeAccountRef>
<PurchaseDesc>Test Product</PurchaseDesc>
<PurchaseCost>0</PurchaseCost>
<ExpenseAccountRef name="Cost of Goods Sold">50</ExpenseAccountRef>
<TrackQtyOnHand>false</TrackQtyOnHand>
</Item>
</QueryResponse>
</IntuitResponse>
The most critical problems I'm encountering are:
1. The item gets added as a Service type not Inventory
2. The TrackQtyOnHand is false, not true
3. The AssetAccountRef is missing,
4. The initial QtyOnHand is missin,
5. The PurchaseCost and UnitPrice are 0
What's going on? Is this SDK broken? Or am I missing something. I've been able to get very similar code working for locations (departments), categories (classes).
Thanks in advance for any help you can provide.

Please check if you have enabled "QtyOnHand" from QBO's Preference menu.
I've tried this from APIExplorer. It works fine there. Please have a look.
Create Request
<Item xmlns="http://schema.intuit.com/finance/v3" sparse="false">
<Name>ABCD_CLONE</Name>
<Active>true</Active>
<FullyQualifiedName>ABCD</FullyQualifiedName>
<Taxable>false</Taxable>
<UnitPrice>45</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef name="Sales of Product Income">49</IncomeAccountRef>
<PurchaseCost>0</PurchaseCost>
<ExpenseAccountRef name="Cost of Goods Sold">50</ExpenseAccountRef>
<AssetAccountRef name="Inventory Asset">51</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>1000</QtyOnHand>
<InvStartDate>2013-12-31</InvStartDate>
</Item>
Response
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-12-30T19:42:45.781-08:00">
<Item domain="QBO" sparse="false">
<Id>6</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-12-30T19:42:45-08:00</CreateTime>
<LastUpdatedTime>2013-12-30T19:42:45-08:00</LastUpdatedTime>
</MetaData>
<Name>ABCD_CLONE</Name>
<Active>true</Active>
<FullyQualifiedName>ABCD_CLONE</FullyQualifiedName>
<Taxable>false</Taxable>
<UnitPrice>45</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef name="Sales of Product Income">49</IncomeAccountRef>
<PurchaseCost>0</PurchaseCost>
<ExpenseAccountRef name="Cost of Goods Sold">50</ExpenseAccountRef>
<AssetAccountRef name="Inventory Asset">51</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>1000</QtyOnHand>
<InvStartDate>2013-12-31</InvStartDate>
</Item>
</IntuitResponse>
If possible please grab the original request XML from code by configuring the logger in debug mode.
PN - There is an open bug related to QtyOnHand update. That is expected to be fixed in the next release.
Thanks

The main reason that your C# code does not work is because Intuit requires that you set various "Is Specified" properties, such as TrackQtyOnHandSpecified = true.
Hopefully they will improve their property setting to automatically set these Specified fields to true when we assign data to them. For now, you will need to look at each property you set to see if there is an associated Specified property to set at the same time. Awkward for now.
Cheers,
Greg

It seems they still didn't fix this issue. But here I am, I can tell u a workaround to fix this issue.
Just create a new Item as you usually do :
Item i = new Item();
i.Name = "Art 1";
i.TrackQtyOnHand = true;
i.TypeSpecified = true;
i.Type = ItemTypeEnum.Inventory;
i.QtyOnHand = 0;
i.InvStartDate = DateTime.Now;
i.PurchaseCost = 10;
i.UnitPrice = 111;
i.FullyQualifiedName = "Art 1";
i.IncomeAccountRef = new ReferenceType
{
Value = "63"
};
i.ExpenseAccountRef = new ReferenceType
{
Value = "64"
};
i.AssetAccountRef = new ReferenceType
{
Value = "65",
name = "Inventory Asset"
};
Item newItem = dataService.Add(i) as Item;
Now to fix this you must make immediately an update to the newly added product as so:
newItem.UnitPrice = i.UnitPrice;
newItem.PurchaseCost = i.PurchaseCost;
newItem.QtyOnHand = i.QtyOnHand;
newItem.InvStartDate = i.InvStartDate;
newItem.Type = i.Type;
newItem.TypeSpecified = true;
newItem.AssetAccountRef = i.AssetAccountRef;
i = dataService.Update(newItem) as Item;
And wala, that's it.
Hope it will be helpful to somebody ;)

Related

How to merge word documents with different headers using openxml?

I am trying to merge multiple documents into a single one by following examples as posted in this other post.
I am using AltChunk altChunk = new AltChunk(). When documents are merged, it does not seem to retain seperate hearders of each document. The merged document will contain the headers of the first document during the merging. If the first document being merged contains no hearders, then all the rest of the newly merged document will contain no headers, and vise versa.
My question is, how can I preserve different headers of the documents being merged?
Merge multiple word documents into one Open Xml
using System;
using System.IO;
using System.Linq;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
namespace WordMergeProject
{
public class Program
{
private static void Main(string[] args)
{
byte[] word1 = File.ReadAllBytes(#"..\..\word1.docx");
byte[] word2 = File.ReadAllBytes(#"..\..\word2.docx");
byte[] result = Merge(word1, word2);
File.WriteAllBytes(#"..\..\word3.docx", result);
}
private static byte[] Merge(byte[] dest, byte[] src)
{
string altChunkId = "AltChunkId" + DateTime.Now.Ticks.ToString();
var memoryStreamDest = new MemoryStream();
memoryStreamDest.Write(dest, 0, dest.Length);
memoryStreamDest.Seek(0, SeekOrigin.Begin);
var memoryStreamSrc = new MemoryStream(src);
using (WordprocessingDocument doc = WordprocessingDocument.Open(memoryStreamDest, true))
{
MainDocumentPart mainPart = doc.MainDocumentPart;
AlternativeFormatImportPart altPart =
mainPart.AddAlternativeFormatImportPart(AlternativeFormatImportPartType.WordprocessingML, altChunkId);
altPart.FeedData(memoryStreamSrc);
var altChunk = new AltChunk();
altChunk.Id = altChunkId;
OpenXmlElement lastElem = mainPart.Document.Body.Elements<AltChunk>().LastOrDefault();
if(lastElem == null)
{
lastElem = mainPart.Document.Body.Elements<Paragraph>().Last();
}
//Page Brake einfügen
Paragraph pageBreakP = new Paragraph();
Run pageBreakR = new Run();
Break pageBreakBr = new Break() { Type = BreakValues.Page };
pageBreakP.Append(pageBreakR);
pageBreakR.Append(pageBreakBr);
return memoryStreamDest.ToArray();
}
}
}
I encountered this question a few years ago and spent quite some time on it; I eventually wrote a blog article that links to a sample file. Achieving integrating files with headers and footers using Alt-Chunk is not straight-forward. I'll try to cover the essentials, here. Depending on what kinds of content the headers and footers contain (and assuming Microsoft has not addressed any of the problems I originally ran into) it may not be possible to rely soley on AltChunk.
(Note also that there may be Tools/APIs that can handle this - I don't know and asking that on this site would be off-topic.)
Background
Before attacking the problem, it helps to understand how Word handles different headers and footers. To get a feel for it, start Word...
Section Breaks / Unlinking headers/footers
Type some text on the page and insert a header
Move the focus to the end of the page and go to the Page Layout tab in the Ribbon
Page Setup/Breaks/Next Page section break
Go into the Header area for this page and note the information in the blue "tags": you'll see a section identifier on the left and "Same as previous" on the right. "Same as Previous" is the default, to create a different Header click the "Link to Previous" button in the Header
So, the rule is:
a section break is required, with unlinked headers (and/or footers),
in order to have different header/footer content within a document.
Master/Sub-documents
Word has an (in)famous functionality called "Master Document" that enables linking outside ("sub") documents into a "master" document. Doing so automatically adds the necessary section breaks and unlinks the headers/footers so that the originals are retained.
Go to Word's Outline view
Click "Show Document"
Use "Insert" to insert other files
Notice that two section breaks are inserted, one of the type "Next page" and the other "Continuous". The first is inserted in the file coming in; the second in the "master" file.
Two section breaks are necessary when inserting a file because the last paragraph mark (which contains the section break for the end of the document) is not carried over to the target document. The section break in the target document carries the information to unlink the in-coming header from those already in the target document.
When the master is saved, closed and re-opened the sub documents are in a "collapsed" state (file names as hyperlinks instead of the content). They can be expanded by going back to the Outline view and clicking the "Expand" button. To fully incorporate a sub-document into the document click on the icon at the top left next to a sub-document then clicking "Unlink".
Merging Word Open XML files
This, then, is the type of environment the Open XML SDK needs to create when merging files whose headers and footers need to be retained. Theoretically, either approach should work. Practically, I had problems with using only section breaks; I've never tested using the Master Document feature in Word Open XML.
Inserting section breaks
Here's the basic code for inserting a section break and unlinking headers before bringing in a file using AltChunk. Looking at my old posts and articles, as long as there's no complex page numbering involved, it works:
private void btnMergeWordDocs_Click(object sender, EventArgs e)
{
string sourceFolder = #"C:\Test\MergeDocs\";
string targetFolder = #"C:\Test\";
string altChunkIdBase = "acID";
int altChunkCounter = 1;
string altChunkId = altChunkIdBase + altChunkCounter.ToString();
MainDocumentPart wdDocTargetMainPart = null;
Document docTarget = null;
AlternativeFormatImportPartType afType;
AlternativeFormatImportPart chunk = null;
AltChunk ac = null;
using (WordprocessingDocument wdPkgTarget = WordprocessingDocument.Create(targetFolder + "mergedDoc.docx", DocumentFormat.OpenXml.WordprocessingDocumentType.Document, true))
{
//Will create document in 2007 Compatibility Mode.
//In order to make it 2010 a Settings part must be created and a CompatMode element for the Office version set.
wdDocTargetMainPart = wdPkgTarget.MainDocumentPart;
if (wdDocTargetMainPart == null)
{
wdDocTargetMainPart = wdPkgTarget.AddMainDocumentPart();
Document wdDoc = new Document(
new Body(
new Paragraph(
new Run(new Text() { Text = "First Para" })),
new Paragraph(new Run(new Text() { Text = "Second para" })),
new SectionProperties(
new SectionType() { Val = SectionMarkValues.NextPage },
new PageSize() { Code = 9 },
new PageMargin() { Gutter = 0, Bottom = 1134, Top = 1134, Left = 1318, Right = 1318, Footer = 709, Header = 709 },
new Columns() { Space = "708" },
new TitlePage())));
wdDocTargetMainPart.Document = wdDoc;
}
docTarget = wdDocTargetMainPart.Document;
SectionProperties secPropLast = docTarget.Body.Descendants<SectionProperties>().Last();
SectionProperties secPropNew = (SectionProperties)secPropLast.CloneNode(true);
//A section break must be in a ParagraphProperty
Paragraph lastParaTarget = (Paragraph)docTarget.Body.Descendants<Paragraph>().Last();
ParagraphProperties paraPropTarget = lastParaTarget.ParagraphProperties;
if (paraPropTarget == null)
{
paraPropTarget = new ParagraphProperties();
}
paraPropTarget.Append(secPropNew);
Run paraRun = lastParaTarget.Descendants<Run>().FirstOrDefault();
//lastParaTarget.InsertBefore(paraPropTarget, paraRun);
lastParaTarget.InsertAt(paraPropTarget, 0);
//Process the individual files in the source folder.
//Note that this process will permanently change the files by adding a section break.
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(sourceFolder);
IEnumerable<System.IO.FileInfo> docFiles = di.EnumerateFiles();
foreach (System.IO.FileInfo fi in docFiles)
{
using (WordprocessingDocument pkgSourceDoc = WordprocessingDocument.Open(fi.FullName, true))
{
IEnumerable<HeaderPart> partsHeader = pkgSourceDoc.MainDocumentPart.GetPartsOfType<HeaderPart>();
IEnumerable<FooterPart> partsFooter = pkgSourceDoc.MainDocumentPart.GetPartsOfType<FooterPart>();
//If the source document has headers or footers we want to retain them.
//This requires inserting a section break at the end of the document.
if (partsHeader.Count() > 0 || partsFooter.Count() > 0)
{
Body sourceBody = pkgSourceDoc.MainDocumentPart.Document.Body;
SectionProperties docSectionBreak = sourceBody.Descendants<SectionProperties>().Last();
//Make a copy of the document section break as this won't be imported into the target document.
//It needs to be appended to the last paragraph of the document
SectionProperties copySectionBreak = (SectionProperties)docSectionBreak.CloneNode(true);
Paragraph lastpara = sourceBody.Descendants<Paragraph>().Last();
ParagraphProperties paraProps = lastpara.ParagraphProperties;
if (paraProps == null)
{
paraProps = new ParagraphProperties();
lastpara.Append(paraProps);
}
paraProps.Append(copySectionBreak);
}
pkgSourceDoc.MainDocumentPart.Document.Save();
}
//Insert the source file into the target file using AltChunk
afType = AlternativeFormatImportPartType.WordprocessingML;
chunk = wdDocTargetMainPart.AddAlternativeFormatImportPart(afType, altChunkId);
System.IO.FileStream fsSourceDocument = new System.IO.FileStream(fi.FullName, System.IO.FileMode.Open);
chunk.FeedData(fsSourceDocument);
//Create the chunk
ac = new AltChunk();
//Link it to the part
ac.Id = altChunkId;
docTarget.Body.InsertAfter(ac, docTarget.Body.Descendants<Paragraph>().Last());
docTarget.Save();
altChunkCounter += 1;
altChunkId = altChunkIdBase + altChunkCounter.ToString();
chunk = null;
ac = null;
}
}
}
If there's complex page numbering (quoted from my blog article):
Unfortunately, there’s a bug in the Word application when integrating
Word document “chunks” into the main document. The process has the
nasty habit of not retaining a number of SectionProperties, among them
the one that sets whether a section has a Different First Page
() and the one to restart Page Numbering () in a section. As long as your documents don’t need to
manage these kinds of headers and footers you can probably use the
“altChunk” approach.
But if you do need to handle complex headers and footers the only
method currently available to you is to copy in the each document in
its entirety, part-by-part. This is a non-trivial undertaking, as
there are numerous possible types of Parts that can be associated not
only with the main document body, but also with each header and footer
part.
...or try the Master/Sub Document approach.
Master/Sub Document
This approach will certainly maintain all information, it will open as a Master document, however, and the Word API (either the user or automation code) is required to "unlink" the sub-documents to turn it into a single, integrated document.
Opening a Master Document file in the Open XML SDK Productivity Tool shows that inserting sub documents into the master document is a fairly straight-forward procedure:
The underlying Word Open XML for the document with one sub-document:
<w:body xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:p>
<w:pPr>
<w:pStyle w:val="Heading1" />
</w:pPr>
<w:subDoc r:id="rId6" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" />
</w:p>
<w:sectPr>
<w:headerReference w:type="default" r:id="rId7" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" />
<w:type w:val="continuous" />
<w:pgSz w:w="11906" w:h="16838" />
<w:pgMar w:top="1417" w:right="1417" w:bottom="1134" w:left="1417" w:header="708" w:footer="708" w:gutter="0" />
<w:cols w:space="708" />
<w:docGrid w:linePitch="360" />
</w:sectPr>
</w:body>
and the code:
public class GeneratedClass
{
// Creates an Body instance and adds its children.
public Body GenerateBody()
{
Body body1 = new Body();
Paragraph paragraph1 = new Paragraph();
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId(){ Val = "Heading1" };
paragraphProperties1.Append(paragraphStyleId1);
SubDocumentReference subDocumentReference1 = new SubDocumentReference(){ Id = "rId6" };
paragraph1.Append(paragraphProperties1);
paragraph1.Append(subDocumentReference1);
SectionProperties sectionProperties1 = new SectionProperties();
HeaderReference headerReference1 = new HeaderReference(){ Type = HeaderFooterValues.Default, Id = "rId7" };
SectionType sectionType1 = new SectionType(){ Val = SectionMarkValues.Continuous };
PageSize pageSize1 = new PageSize(){ Width = (UInt32Value)11906U, Height = (UInt32Value)16838U };
PageMargin pageMargin1 = new PageMargin(){ Top = 1417, Right = (UInt32Value)1417U, Bottom = 1134, Left = (UInt32Value)1417U, Header = (UInt32Value)708U, Footer = (UInt32Value)708U, Gutter = (UInt32Value)0U };
Columns columns1 = new Columns(){ Space = "708" };
DocGrid docGrid1 = new DocGrid(){ LinePitch = 360 };
sectionProperties1.Append(headerReference1);
sectionProperties1.Append(sectionType1);
sectionProperties1.Append(pageSize1);
sectionProperties1.Append(pageMargin1);
sectionProperties1.Append(columns1);
sectionProperties1.Append(docGrid1);
body1.Append(paragraph1);
body1.Append(sectionProperties1);
return body1;
}
}

Create OpenXML Table With C#

I'm having issues making an actual table in my excel file. The file is created and all the data is there, but when I open the file the table definition doesn't exist. I'm using this method to try and turn the data range into a table.
private static Table CreateTable(string tableRange, IEnumerable<string> headers)
{
var table = new Table {
Id = 1,
Name = "Table 1",
DisplayName = "Table 1",
Reference = tableRange,
TotalsRowShown = false,
HeaderRowFormatId = 0
};
table.AddNamespaceDeclaration("x", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
UInt32Value i = 1;
var columns = new TableColumns();
foreach (var header in headers) {
columns.Append(new TableColumn {
Id = i++,
Name = header
});
}
var style = new TableStyleInfo {
Name = "TableStyleMedium2",
ShowFirstColumn = false,
ShowLastColumn = false,
ShowRowStripes = true,
ShowColumnStripes = false
};
table.Append(new AutoFilter { Reference = tableRange });
table.Append(columns);
table.Append(style);
return table;
}
The tableRange variable is a simple excel range string, like "A1:D27". I'm trying to add it to the worksheet like so:
var tableDefinitionPart = worksheetPart.AddNewPart<TableDefinitionPart>();
tableDefinitionPart.Table = CreateTable(tableRange, headers);
I'm not getting any errors when I open the file.
If I open the file with the XML Productivity tool and click on the "x:table (Table)" part within the worksheet I see this:
<x:table xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1" name="Table 1" displayName="Table 1" ref="A1:Z2" totalsRowShown="0" headerRowDxfId="0">
<x:autoFilter ref="A1:Z2" />
<x:tableColumns>
<x:tableColumn id="1" name="Lab Name" />
....
<x:tableColumn id="26" name="Description" />
</x:tableColumns>
<x:tableStyleInfo name="TableStyleMedium2" showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0" />
</x:table>
So it seems like I'm putting something properly into the file. It's just not an actual "table" as far as Excel is concerned.

How to set TotalAmount for SalesReciept

I'm using QBO Rest API V3 SDK and trying to create a deposit onto an account. It seems there isn't a deposit transaction anymore, so am trying to use a SalesReciept to do so.
The call is succeeding and the transaction is created however the SalesReciept is returned with a TotalAmount of zero. When I look at the QBO application it shows a 0 Deposit amount as well.
I noticed there was a UnitPrice on the API, but was missing from the SDK, so I hand crafted a web request and it still came back with a 0.
If there is another approach I should take let me know.
var deposit = new SalesReceipt()
{
DepositToAccountRef = new ReferenceType()
{
Value = "1",
name = "MyAccount"
},
TxnDate = transaction.TransactionDate,
TxnDateSpecified = true,
TotalAmt = transaction.Amount,
TotalAmtSpecified = true,
Line = new[]
{
new Line()
{
Amount = transaction.Amount,
AmountSpecified = true,
Description = transaction.DisplayBody,
DetailType = LineDetailTypeEnum.SalesItemLineDetail,
DetailTypeSpecified = true,
AnyIntuitObject = new SalesItemLineDetail()
{
ItemRef = new ReferenceType(){
Value = qboIntegration.IncomeAccountId,
name = GetIncomeAccountName(),
},
Qty = 1,
QtySpecified = true,
TaxInclusiveAmt = transaction.Amount,
TaxInclusiveAmtSpecified = true,
ServiceDate = transaction.TransactionDate,
ServiceDateSpecified = true,
},
}
},
};
I've not tried this using .net sdk. You can try the following ( Ref - SO Thread).
AnyIntuitObject = new SalesItemLineDetail()
{
ItemElementName = ItemChoiceType.UnitPrice,
AnyIntuitObject = amount,
...
},
DetailType = LineDetailTypeEnum.SalesItemLineDetail
To get the correct object structure you can create a salesReceipt from QBO UI(with desired attribute value) and retrieve the same using getById endpoint.
To do the above, you can use the ApiExplorer tool as well.
https://developer.intuit.com/apiexplorer?apiname=V3QBO
Thanks
After contacting quickbooks. It is not possible with the current iteration (V3) of the api. They are considering adding this in the next version.

How to read the unit price of an Item with IPP DevKit

I've seen elsewhere how to set the UnitPrice on an Item, using the wiley and elusive Item1 field as Intuit.Ipp.Data.Qbd.Money. But how do I READ the unit price from the Item1 field? I can't cast it. The new operator doesn't work ("new ...Money(myItem.Item1)"). So how do I get the price?
I realize the DevKit will probably never be changed so this makes sense. But can we at least get some doc explaining all those strange "xxxItemxxx" fields?
ServiceContext context = new ServiceContext(oauthValidator, realmId, intuitServiceType);
DataServices commonService = new DataServices(context);
Intuit.Ipp.Data.Qbd.Item qbdItem = new Intuit.Ipp.Data.Qbd.Item();
Intuit.Ipp.Data.Qbd.Money unitPrice = new Intuit.Ipp.Data.Qbd.Money();
unitPrice.Amount = 22;
unitPrice.AmountSpecified = true;
qbdItem.Item1 = unitPrice;
IEnumerable<Intuit.Ipp.Data.Qbd.Item> qbdItemsResult = commonService.FindAll(qbdItem, 1, 10) as IEnumerable<Intuit.Ipp.Data.Qbd.Item>;
foreach (var itemResult in qbdItemsResult)
{
Intuit.Ipp.Data.Qbd.Money test1UnitPrice = itemResult.Item1 as Intuit.Ipp.Data.Qbd.Money;
}
You can use the above code for .Net.
Response XML of Item entity suggests that 'UntiPrice' is a top level tag.
I tried this usecase using java. PFB code.
QBItemService itemService = QBServiceFactory.getService(context,QBItemService.class);
items = itemService.findAll(context,1, 100);
for (QBItem item : items) {
System.out.println("Name - " + item.getName() + " UnitPrice - " + item.getUnitPrice().getAmount());
Can you please try the same in .Net and let me know if it works in the same way.
Intuit.Ipp.Data.Qbd.Money [ getAmount() ]
Thanks

Trying to insert QBO invoice with IPP.NET

I am attempting to insert an invoice into Quickbooks Online using IPP.NET. The problem seems to be in setting the item.
Here is a snippet of my VB code for the first line, which works fine...
Dim qboInvoiceLine1 as new intuit.ipp.data.qbo.invoiceline
qboInvoiceline1.desc="Desc1"
qboInvoiceLine1.amount=10
qboInvoiceLine1.AmountSpecified=True
If I add the following code for setting the item, I get an error forming the XML...
Dim items1 as List(Of Intuit.Ipp.Data.Qbo.Item)=New List(Of Intuit.Ipp.Data.Qbo.Item)
Dim item1 as new intuit.ipp.data.qbo.item
item1.id=new intuit.ipp.data.qbo.idtype
item1.id.value="1"
items1.add(item1)
qboInvoiceLine1.Items=items1.ToArray
I do not even understand why the item ID seems to be some kind of array or list of items. One source of documentation suggests there is an itemID property of the invoice line, but this does not seem to be the case. Can anyone give me code for setting the itemID for an invoice line?
ItemsChoiceType2[] invoiceItemAttributes = { ItemsChoiceType2.ItemId, ItemsChoiceType2.UnitPrice,ItemsChoiceType2.Qty };
object[] invoiceItemValues = { new IdType() { idDomain = idDomainEnum.QB, Value = "5" }, new decimal(33), new decimal(2) };
var invoiceLine = new InvoiceLine();
invoiceLine.Amount = 66;
invoiceLine.AmountSpecified = true;
invoiceLine.Desc = "test " + DateTime.Now.ToShortDateString();
invoiceLine.ItemsElementName = invoiceItemAttributes;
invoiceLine.Items = invoiceItemValues;
invoiceLine.ServiceDate = DateTime.Now;
invoiceLine.ServiceDateSpecified = true;
listLine.Add(invoiceLine);