Office365-REST-Python-Client
Office365-REST-Python-Client copied to clipboard
Follow SP.ResourcePath links?
Hello!
My Sharepoint/OneDrive contains a few folders that are shortcuts to other folders shared with me. How can I follow these links to list the linked folder contents?
url='Documents'
root_folder = ctx.web.get_folder_by_server_relative_url(url).get().execute_query()
root_folder.expand(["Files","Folders"]).get().execute_query()
root_folder.files[0].__dict__
Output:
{'_properties': {'CheckInComment': '',
'CheckOutType': 2,
'ContentTag': '{F4736AB1-CBC3-484A-8183-042DB9DB4F90},10,1',
'CustomizedPageStatus': 0,
'ETag': '"{F4736AB1-CBC3-484A-8183-042DB9DB4F90},10"',
'Exists': True,
'ExistsAllowThrowForPolicyFailures': True,
'IrmEnabled': False,
'Length': '0',
'Level': 1,
'LinkingUri': 'https://xx-my.sharepoint.com/personal/xx/Documents/CLSI?d=wf4736ab1cbc3484a8183042db9db4f90',
'LinkingUrl': 'https://xx-my.sharepoint.com/personal/xx/Documents/CLSI?d=wf4736ab1cbc3484a8183042db9db4f90',
'MajorVersion': 1,
'MinorVersion': 0,
'Name': 'CLSI',
'ServerRelativeUrl': '/personal/xx/Documents/CLSI',
'TimeCreated': datetime.datetime(2023, 12, 20, 15, 58, 19),
'TimeLastModified': datetime.datetime(2023, 12, 20, 15, 58, 20),
'Title': None,
'UIVersion': 512,
'UIVersionLabel': '1.0',
'UniqueId': 'f4736ab1-cbc3-484a-8183-042db9db4f90'},
'_ser_property_names': [],
'_query_options': ,
'_parent_collection': [SP.ResourcePath, SP.ResourcePath, SP.ResourcePath],
'_context': <office365.sharepoint.client_context.ClientContext at 0x7f5540db6a40>,
'_entity_type_name': None,
'_resource_path': /Web/GetFileById('f4736ab1-cbc3-484a-8183-042db9db4f90')}
I'm connected to SP via app principal (client_id, client_secret). For some reason, I can't get OneDrive to work through MSAL.