def test5_get_list_item_via_caml(self): item_id = self.__class__.target_item.id caml_query = CamlQuery.parse( "<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>{0}</Value></Eq></Where>" .format(item_id)) result = self.target_list.get_items(caml_query).execute_query() self.assertEqual(len(result), 1)
def get_items(self, caml_query=None): """Returns a collection of items from the list based on the specified query. :type caml_query: CamlQuery """ if not caml_query: caml_query = CamlQuery.create_all_items_query() items = ListItemCollection(self.context, ResourcePath("items", self.resource_path)) qry = ServiceOperationQuery(self, "GetItems", None, caml_query, "query", items) self.context.add_query(qry) return items
def _get_items_inner(): caml_query = CamlQuery.parse(self.view_query) qry = ServiceOperationQuery(self._parent_list, "GetItems", None, caml_query, "query", self._parent_list.items) self.context.add_query(qry)