Office365-REST-Python-Client
Office365-REST-Python-Client copied to clipboard
Caml Query filter not working
Hi All ,
I am trying to find a file in the Sharepoint library using the CAML query. However, the query is not returning what I want. It is only returning the first 100 folders and files. Even if I change the value of the file_name, it still returns the same result. I am wondering if I am missing any code in the query or if there is another method that can help me find the file in the SharePoint library.
query=CamlQuery()
query.ViewXml =f"<View Scope='RecursiveAll'><Query><Where><BeginsWith><FieldRef Name='FileLeafRef'/><Value Type='Text'>{file_name}</Value></BeginsWith></Where></Query></View>"
items = library.get_items(query)
ctx.load(items)
ctx.execute_query()
for i in items:
print(i.properties)