-
Notifications
You must be signed in to change notification settings - Fork 443
Description
Hi,
I made an app that's makes me able to sync sharepoints files/path from sharepoint to local path.
To do this, i have created an App in the Entra@Microsoft.com web site. On it, i have created some tokens/credentials, grant some rights (Sites.read.All, Files.read.all, Sites.Selected ).
So, i can sucessfully connect to the sharepoint ( that's a good start ! )
I am able to see paths (That's a good point too).
But, when i am exploring paths, i am not able to see files in it. I am getting only items of type "folder", but no "file" type.
To get the elements :
def list_children(self, path: str):
_ = None
if path == "" or path == None:
logger.info("Getting root folder")
_ = self.o365_target.get_root_folder()
else:
logger.info(f"Getting folder: `{path}`")
_ = self.o365_target.get_item_by_path("/" + path)
for item in _.get_items():
logger.info(f"reading item: `{path}/{item.name}`")
yield item
When i am doing it in a dumb way, it gives me the same result.
for item in _.get_items():
logger.info("level1")
logger.info(item.name)
for _item in item.get_items():
logger.info("level2")
logger.info(_item.name)
for __item in _item.get_items():
logger.info("level3")
logger.info(__item.name)
This gives me only folders, no files.
I think, my code is good (i ve tested it on a dev environnement) but now, in the prod env' something is missing but dont get what.
I think it's a grant but dont know where to put....
Thx
Some logs :
INFO src.connectors.o365.drive:drive.py:79 Getting root folder
INFO src.connectors.o365.drive:drive.py:87 level1
INFO src.connectors.o365.drive:drive.py:88 BIZ
INFO src.connectors.o365.drive:drive.py:87 level1
INFO src.connectors.o365.drive:drive.py:88 COM
INFO src.connectors.o365.drive:drive.py:87 level1
INFO src.connectors.o365.drive:drive.py:88 IT
INFO src.connectors.o365.drive:drive.py:90 level2
INFO src.connectors.o365.drive:drive.py:91 BACKUPS
INFO src.connectors.o365.drive:drive.py:93 level3
INFO src.connectors.o365.drive:drive.py:94 DB
INFO src.connectors.o365.drive:drive.py:90 level2
INFO src.connectors.o365.drive:drive.py:91 GIT
The structure :
- root
---- BIZ/
---- COM/
---- IT/
------- a_file.txt
------- BACKUPS/
---------- DB/
------- GIT/