Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_folder_pseudo_item(item_name):
item = Item()
item.name = item_name
item.folder = Folder()
return item
def __create_folder(self, item_id, folder_name): #Create folder with provided name
f = onedrivesdk.Folder()
i = onedrivesdk.Item()
i.name = folder_name
i.folder = f
folder = self.__onedrive_service.item(drive='me', id=item_id).children.add(i)
log_success('[+] creating new directory...')
return folder.id #Return folder object ID
def _get_folder_pseudo_item(item_name):
item = Item()
item.name = item_name
item.folder = Folder()
return item
def create_folder(self, name, parent_id=None, parent_path=None):
"""
Create a new folder in OneDrive
:param name: str, new folder name
:param parent_id: str, parent id
:param parent_path: str, parent path
:return:
"""
folder_to_create = onedrivesdk.Item()
folder_to_create.name = name
folder_to_create.folder = onedrivesdk.Folder()
item = self.client.item(id=parent_id, path=parent_path)
return item.children.add(folder_to_create)