Joins in SharePoint COM

Joins in SharePoint COM

private void GetParts(string searchSku)
  List partsList = clientContext.Web.Lists.GetByTitle("Parts");
  List inventoryLocationsList =
    clientContext.Web.Lists.GetByTitle("Inventory Locations");

  CamlQuery camlQueryPartsList = new CamlQuery();
  camlQueryPartsList.ViewXml =
              <FieldRef Name='SKU' />
              <Value Type='Text'>" + searchSku + @"</Value>

  CamlQuery camlQueryInvLocationList = new CamlQuery();
  camlQueryInvLocationList.ViewXml =
              <FieldRef Name='PartLookupSKU' />
              <Value Type='Lookup'>" + searchSku + @"</Value>
          <OrderBy Override='TRUE'>
            <FieldRef Name='PartLookupSKU' />
          <FieldRef Name='PartLookup' LookupId='TRUE' />
          <FieldRef Name='PartLookupSKU' />
          <FieldRef Name='PartLookupTitle' />
          <FieldRef Name='PartLookupDescription' />
          <FieldRef Name='BinNumber' />
          <FieldRef Name='Quantity' />
          <Field Name='PartLookupSKU' Type='Lookup' List='PartLookup'
                 ShowField='SKU' />
          <Field Name='PartLookupTitle' Type='Lookup' List='PartLookup'
                 ShowField='Title' />
          <Field Name='PartLookupDescription' Type='Lookup' List='PartLookup'
                 ShowField='PartsDescription' />
          <Join Type='LEFT' ListAlias='PartLookup'>
          <!--List Name: Parts-->
              <FieldRef Name='PartLookup' RefType='ID' />
              <FieldRef List='PartLookup' Name='ID' />

  partListItems = partsList.GetItems(camlQueryPartsList);
  inventoryLocationListItems =

  clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed);

About sharepointsriram

9+ Yrs of IT experience
This entry was posted in Sharepoint 2010 CAML. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s