0

I have successfully connected to Sharepoint via python shareplum library and I am able to manipulate with contents as I want. However, I am unable to find way to delete any folder I give it. Shareplum keeps throwing at me that "You must pass the relative folder url to delete a folder".

I am using available method as from Shareplum documentation (.delete_folder(relative_url)) enter image description here

Could someone please help how to either get the relative path of any folder or how do I modify my code to make this work?

For testing purposes, I have created empty folder 'deleteme' and my code is set up in trying to delete it.

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

authcookie = Office365(r'https://mysite.sharepoint.com', username='my.email@domain.com', password='mypass').GetCookies()

site = Site(r'https://mysite.sharepoint.com/sites/mysitelocation/',version=Version.v365, authcookie=authcookie)

site.Folder('Shared Documents').delete_folder('deleteme')

Thank you a lot!

1 Answers1

0

Just managed to work this one out by adding:

folder = site.Folder('Shared Documents/General/deleteFolder/')

folder.delete_folder(folder.folder_name)