Skip to content
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

Create Document library, folders and upload file in Team sites in sharepoint instead of communication site? #179

Closed
vamsivks opened this issue Mar 16, 2020 · 1 comment
Labels

Comments

@vamsivks
Copy link

@vgrem Can you give me an example for a document library, folder and file upload in team site rather than communication site? because of old code only supporting communication site

@vgrem vgrem added the question label Mar 16, 2020
@vgrem
Copy link
Owner

vgrem commented May 3, 2020

That's pretty much the same, operations stays the same no matter whether is a modern team site or classic one. Once the client is initialized against a modern site:

ctx = ClientContext.connect_with_credentials("https://contoso.sharepoint.com/sites/teamSite",
                                             UserCredential(username,password))

a document library could be created like this:

properties = ListCreationInformation()
properties.BaseTemplate = ListTemplateType.DocumentLibrary
properties.Title = "Team Documents"
target_lib = ctx.web.lists.add(properties)
ctx.execute_query()

There is a plenty of examples for another operations.

@vgrem vgrem closed this as completed May 3, 2020
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