def read_folder_and_files_alt(context, list_title): """Read a folder example""" list_obj = context.web.lists.get_by_title(list_title) qry = CamlQuery.create_all_items_query() items = list_obj.get_items(qry) context.execute_query() for cur_item in items: print("File name: {0}".format(cur_item.properties["Title"]))
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.resourcePath)) qry = ServiceOperationQuery(self, "GetItems", None, caml_query, "query", items) self.context.add_query(qry) return items