Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

Error while expanding folders for the sharepoint library

Open masics opened this issue 2 years ago • 2 comments

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?

masics avatar Feb 05 '23 09:02 masics

Hi,

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

vgrem avatar Jul 01 '23 20:07 vgrem

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."

melihsunbul avatar Jul 03 '23 14:07 melihsunbul