Python ExchangeLib:正在移动项的文件夹

2024-09-28 03:17:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Python中使用ExchangeLib。想把我的邮件从一个文件夹移到另一个文件夹。在

    # I logined the Exchange Server and took the items as below:
    all_items=account.inbox.all()
    # then wanted to move the folder as below:
    target_folder=account.inbox.get_folder_by_name("TCN")
    recentone = all_items[0]
    # then I wanted to move the folder to "TCN"
    recentone.folder=target_folder;
    recentone.save()

但是,它不起作用,我目前无法找到解决办法。 有没有其他方法可以移动项目的文件夹?在

提前谢谢你。在


Tags: theto文件夹targetmoveasitemsaccount
1条回答
网友
1楼 · 发布于 2024-09-28 03:17:20

我已经把问题发到了github上,得到的答案如下:

不能像这样在文件夹之间移动项目:-)需要使用move()方法。见https://github.com/ecederstrand/exchangelib#creating-updating-deleting-sending-and-moving

简而言之,以下代码适用于移动文件夹

    recentone.move(to_folder=target_folder)

相关问题 更多 >

    热门问题