I did a code on Jupyter to text my logic and it's working correct, but when using this code on a .py file in VSCode I get a wrong asnwer.
I'm using the Office365-REST-Python-Client library to get a list of files of a specific folder on SharePoint, when I use on Jupyter I get the corret answer: 48, but on VSCode I only get 16, as output.
Here is my code
from office365.runtime.auth.user_credential import UserCredential
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File
site_root_url = "SharePoint root url folder"
site_url = "SharePoint site url"
ctx = ClientContext(site_url).with_credentials(UserCredential('email/login','password'))
doc_lib = ctx.web.lists.get_by_title("Documents")
items = doc_lib.items.select(["FileSystemObjectType"]).expand(["File", "Folder"]).get().execute_query()
download_list = []
for item in items: # type: ListItem
file_path = "{}{}".format(site_root_url,item.file.serverRelativeUrl)
download_list.append(file_path)
print(len(download_list))
I tried to delete the folder on SharePoint, create again, and didn't worked. Tried to run the jupyter notebook on VSCode and the same output of 16. Only on Jupyter notebook works correctly, really appreciate some help here, thanks.
For some reason Jupyter was using the get() function and return everything, but on .py file was required to use the get_all() function instead because was to much files.