[python-win32] Troubleshooting with moving Outlook emails to subfolders

Giraud Ludovic (AMUNDI) ludovic.giraud-ext at amundi.com
Wed Aug 18 14:37:47 EDT 2021


Hello Mark,

I am stuck on this issue: https://github.com/mhammond/pywin32/issues/1743

I am trying to move outlook emails into subfolders and this works well most of the time.

However in some cases, probably when a copy of the email I am trying to move already exists into the subfolder, I get the error below using:
x.Move(self.folder.Folders("Inbox").Folders("VALORISATIONS").Folders("Allianz"))

Is there a way to specify that you want to eventually crush the existing email in the folder?


21%|██        | 448/2154 [05:53<22:25,  1.27it/s]
Traceback (most recent call last):
  File "C:/Users/giraudl/PycharmProjects/AutomatePDP/AutomatePDP.py", line 1114, in <module>
    GestionBoitePDP.get_mail_print_to_csv(skipgetpasswords = "Y")
  File "C:/Users/giraudl/PycharmProjects/AutomatePDP/AutomatePDP.py", line 1104, in get_mail_print_to_csv
    self.case_select(macro_to_call,x,attachments)
  File "C:/Users/giraudl/PycharmProjects/AutomatePDP/AutomatePDP.py", line 77, in case_select
    switcher = {
  File "C:/Users/giraudl/PycharmProjects/AutomatePDP/AutomatePDP.py", line 183, in ALLIANZ
    x.Move(self.folder.Folders("Inbox").Folders("VALORISATIONS").Folders("ALLIANZ"))
  File "<COMObject <unknown>>", line 2, in Move
pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', "Les éléments ont été copiés et non pas déplacés, car les éléments d'origine ne peuvent pas être supprimés. Impossible de supprimer cet élément. Il a été déplacé ou supprimé, ou l'accès a été refusé.", None, 0, -2147219840), None)

Thanks for your precious help.

Kind regards,


Ludovic Giraud
PBM - Portfolios & Benchmarks Management
Global Data Management
91 boulevard Pasteur
CS 21564
75730 Paris Cedex 15
Web : www.amundi.com
Tél : +33 1 76 32 67 92 
@ : ludovic.giraud-ext at amundi.com

Suivez-nous sur : 

        

-----Message d'origine-----
De : Mark Hammond <skippy.hammond at gmail.com> 
Envoyé : vendredi 30 juillet 2021 02:55
À : Giraud Ludovic (AMUNDI) <ludovic.giraud-ext at amundi.com>; python-win32 at python.org
Objet : Re: [python-win32] Troubleshooting with pip install pywin32 using WSL2:Ubuntu and Python 3.8.8


On 29/07/2021 11:05 pm, Giraud Ludovic (AMUNDI) wrote:
> Hello,
> 
> When I run pip install pywin32 in WSL2:Ubuntu using Python 3.8.8 I get 
> the following error log:

WSL is a linux environment - pywin32 simply doesn't work there. You can install it via a Windows command-prompt, or in WSL stick to the versions of Python that work for Ubuntu but without pywin32.

HTH,

Mark


More information about the python-win32 mailing list