Skip to content

'NoneType' object has no attribute 'add_child' when use copy_to_using_path #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bhurivaj opened this issue Sep 25, 2023 · 1 comment
Closed
Labels

Comments

@bhurivaj
Copy link

Scenario: When I create record on ERP. I want the system create folder with sub folders and files inside automatically.

Problem: when I created record. It shown that "object has no attribute 'add_child' when use copy_to_using_path"

here: the sample of my code:

        sharepoint_tenant = "https://tenant_name.sharepoint.com/sites/sandbox"

        cert_settings = {
            'client_id': xxxxxxx-xxxxxxxxxxx-xxxxxxxxxxxxx,
            'thumbprint': "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            'cert_path': /path/to/cert.pem
        }

        ctx = ClientContext(sharepoint_tenant).with_client_certificate(tenant_name.onmicrosoft.com, **cert_settings)

        from_url = "/".join(["Document Templates", "project_folder"])
        to_url = "/".join(["Shared Documents", new_name])

        src_folder = ctx.web.get_folder_by_server_relative_url(from_url)
        dest_folder = ctx.web.default_document_library().root_folder.folders
        src_folder.copy_to_using_path(dest_folder, True).execute_query()

on Project folder template
project_folder
-- 01 quotation
-- 02 purchasing order
-- 03 project documents
|-- img
|-- old revision

I have done it on previous version 2.3.3. But when I updated to current version. It made me change to "client certificate"'s way. After that I am getting that problem. Please correct my code if I'm wrong.

Thanks.

vgrem added a commit that referenced this issue Oct 15, 2023
@vgrem vgrem added the bug label Oct 15, 2023
@vgrem
Copy link
Owner

vgrem commented Oct 15, 2023

Hi there,

thank you for catching and reporting this issue, it has been addresed in 2.5.0 release

@vgrem vgrem closed this as completed Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants