O. Schultz
O. Schultz

Reputation: 175

Exchangelib: Create subfolder of subfolder of inbox

Hello I'm currently working with exchangelib. Right now I want to create a subfolder of a subfolder of the inbox and I don't know if it's possible, yet. So I just want to ask if anyone knows more about my problem? My code for creating a subfolder of the inbox is simply:

from exchangelib import Credentials, Account, Folder

credentials = Credentials('[email protected]', 'password')
account = Account('[email protected]', credentials=credentials, autodiscover=True)
folder = Folder(parent=account.inbox, name="subfolder_name")
folder.save()
item.move(folder)

Upvotes: 1

Views: 1336

Answers (2)

O. Schultz
O. Schultz

Reputation: 175

Now that I can test the code, because the CASError as mentioned in Github is gone at least for today, I get a "ValueError: Unsupported type for value None on elem " when I run the code. My code is:

 subfolder = Folder(parent=account.inbox, name="RFS")
 subsubfolder = Folder(parent=subfolder, name="RFS_1150-1199")
 subsubfolder.save()
 folder = Folder(parent=subsubfolder, name=wordfile)
 folder.save()
 item.move(folder)

Upvotes: 0

Erik Cederstrand
Erik Cederstrand

Reputation: 10220

Creating subfolders is possible using exchangelib, and your example should work. If you want to create a sub-subfolder, just use the subfolder as parent:

subfolder = Folder(parent=account.inbox, name="subfolder_name")
subfolder.save()
subsubfolder = Folder(parent=subfolder, name="subsubfolder_name")
subsubfolder.save()

Upvotes: 1

Related Questions