Skip to content

I am stuggling to add items to a sharepoint list #914

Open
@sam2332

Description

@sam2332
    client = GraphClient(get_client)
    site = client.sites
    site = site.get_by_url('https://inghamcnty.sharepoint.com/sites/EmployeeDirectory')
    lists = site.lists
    directory_list = lists.get_by_name("Directory")    # Retrieve items from the list
    # Access the items collection
    items = directory_list

    print(type(directory_list))
   
    print(inspect.getfile(directory_list.__class__))
    item = directory_list.add_item({
        "Title": title,
        "Description": description
    }).execute_query()
    print(f'Item has been added with id: {item.id}')

I feel like i am close but then i look at the types they are always onedrive based and never sharepoint based

from office365.onedrive.sites.site import Site
class SitesWithRoot(EntityCollection[Site]):
    """Sites container"""

these lines in onedrive/sites/sites_with_root.py show how its not using a base object for inheritance causing it to not switch.

or maybe im not understanding how to do sharepoint lists properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions