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

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

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.
9,606 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,572 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,798 questions
0 comments No comments
{count} votes

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

    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);
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful