繁体   English   中英

Python ExchangeLib:项目的移动文件夹

[英]Python ExchangeLib: Moving Folder of the item

我在Python中使用ExchangeLib 并希望将我的电子邮件从A文件夹移动到B文件夹。

    # 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()

但是,它无法正常工作,目前我无法找到解决方案。 还有其他方法可以移动项目的文件夹吗?

先感谢您。

我已将问题发布到github上,并从作者那里得到了答案,如下所示:

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

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

    recentone.move(to_folder=target_folder)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM