Skip to content

How to enumerate and download attachments to a list item #222

@nopslider

Description

@nopslider

Hello,

This is a usage question rather than an issue per se. I'm attempting to download all attachments for a given list item. Here's my code so far:

if ctx_auth.acquire_token_for_app(client_id=clientid,client_secret=clientsecret:
    ctx = ClientContext("https://<removed>.sharepoint.com", ctx_auth)

    list_obj = ctx.web.lists.get_by_title("List title")
    items = list_obj.get_items(CamlQuery.create_all_items_query()) 
    ctx.execute_query()
    for item in items:
        if item.properties['Attachments']:
            #how do I download all attachments here??

else:
        print(ctx_auth.get_last_error())

Any help you could give would be most appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions