How to create Document Library in Sharepont subsite using Graph API ?

asked 2020-09-24T11:55:33.357+00:00
Dnyaneshwar Surywanshi 41 Reputation points

I want to create Document Library in my subsite using graph API.28028-documentlibrary.png

In Attached screenshot i have created two Document Library manually so I want to create same using graph API.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
5,969 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,344 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,353 questions
No comments
{count} votes

Accepted answer
  1. answered 2020-09-24T14:16:15.617+00:00
    sadomovalex 3,586 Reputation points

    hi, try bellow code:

    GraphServiceClient graphClient = new GraphServiceClient( authProvider );
    
    var list = new List
    {
        DisplayName = "Books",
        Columns = (IListColumnsCollectionPage)new List<ColumnDefinition>()
        {
            new ColumnDefinition
            {
                Name = "Author",
                Text = new TextColumn
                {
                }
            },
            new ColumnDefinition
            {
                Name = "PageCount",
                Number = new NumberColumn
                {
                }
            }
        },
        ListInfo = new ListInfo
        {
            Template = "genericList"
        }
    };
    
    await graphClient.Sites["{site-id}"].Lists
        .Request()
        .AddAsync(list);
    

0 additional answers

Sort by: Most helpful