2

I am trying to create a document library with a python script.

I have tried doing it using Microsoft graph but I am having trouble doing with POST request and I didn't succeed.

I also tried doing so with the new O365 library but the library doesn't have any documentation so I've had trouble working with this library.

Anyway I would like some help with this, thanks for the help.😁

1 Answer 1

0

Please have a try below python script:

from config import config
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version

# get data from configuration
username = config['sp_user']
password = config['sp_password']

authcookie = Office365('https://xxxxxx.sharepoint.com', username=username, password=password).GetCookies()

site = Site('https://xxxxxx.sharepoint.com/sites/sbdev/subtest01',version=Version.v365, authcookie=authcookie)

newlist=site.AddList('My New List', description='Great List!', template_id='Document Library')

print(newlist)

The above refer to 'shareplum' library. And you can check the full code here:

BR

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.