vgrem / Office365-REST-Python-Client

Microsoft 365 & Microsoft Graph Library for Python
MIT License
1.3k stars 332 forks source link

Error while expanding folders for the sharepoint library #645

Open masics opened 1 year ago

masics commented 1 year ago

I get following error while executing:

folder: Folder = ctx.web.folders.get_by_path('My_Library')
ctx.load(folder, ["Folders"]).execute_query()

office365.runtime.client_request_exception.ClientRequestException: ('-1, Microsoft.Data.OData.ODataException', "Invalid JSON. A comma character ',' was expected in scope 'Object'. Every two elements in an array and properties of an object must be separated by commas.", '400 Client Error: Bad Request for url: https://mysharepoint.sharepoint.com/sites/MySite/_api/Web/folders/GetByPath(@v)?@v=%7B%22DecodedUrl%22:%20%22My_Library%22%7D?$expand=Folders')

The My_Library is a library created via Teams.

I cannot see My_Library when running code examples/sharepoint/folders/list_folders.py

What I could do to get list of folders?

vgrem commented 1 year ago

Hi,

thank you for reporting this bug, it has been resolved in 2.4.2 version

melihsunbul commented 1 year ago

Hey, I tried 2.4.2 version, but problem still occurs.

folder = ctx.web.folders.get_by_path("Shared Documents/Reports") role_def = ctx.web.role_definitions.get_by_type(RoleType.Contributor) group = ctx.web.site_groups.get_by_name("Demo Group").execute_query() folder.list_item_all_fields.add_role_assignment(group, role_def).execute_query()

Error traceback: office365.runtime.client_request_exception.ClientRequestException: ('-1, Microsoft.Data.OData.ODataException', "Invalid JSON. A comma character ',' was expected in scope 'Object'. Every two elements in an array and properties of an object must be separated by commas."