title: Salesforce: create Opportunity Line Items along with Opportunity from C#
body: <p>using Salesforce's enterprise wsdl I am trying to save opportunity line items along with opportunity. But I am getting following error:</p>
  
  <blockquote>
    <p>INVALID_FIELD: No such column 'OpportunityLineItems' on entity 'Opportunity' If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.</p>
  </blockquote>
  
  <p>Here is my code to create line items:</p>
  
  <pre><code>if (oppLineItems.Count &gt; 0)
  {
       sfOpportunity.OpportunityLineItems = new QueryResult();
       sfOpportunity.HasOpportunityLineItem = true;
       sfOpportunity.OpportunityLineItems.records = oppLineItems.Values.ToArray();
  
       Pricebook2 priceBook = new Pricebook2();
       priceBook.PricebookEntries = new QueryResult();
       priceBook.PricebookEntries.records = new List&lt;PricebookEntry&gt;() { priceBookEntry }.ToArray();
       sfOpportunity.Pricebook2 = priceBook;
  }
  </code></pre>
  
  <p>oppLineItems is a dictionary whole values have proxy objects of opportunity line items.
  sfOpportunity is proxy object of Opportunity which is then sent to Salesforce.</p>