Quantcast

Error trying to do a EmptyFolder() (MAPI)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Error trying to do a EmptyFolder() (MAPI)

Sriram Karra
I have a folder in the Root Folder of a message store that I am trying to clear using EmptyFolder(). The code is as follows:

                folder = store.OpenEntry(eid, None, MOD_FLAG)
                hr = folder.EmptyFolder(0, None, 0)

I get the error: ' Error: unsupported operand type(s) for &: 'NoneType' and 'int'

Changing the code to 

                folder = store.OpenEntry(eid, None, MOD_FLAG)
                hr = folder.EmptyFolder(0, 0, 0)

I get the following exception: "Error: The Python instance can not be converted to a COM object"

This is a command line tool, and I do not need the progress of the operation. Can someone tell me what is the correct way to invoke EmptyFolder()?

Thanks,
Sriram

_______________________________________________
python-win32 mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-win32
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error trying to do a EmptyFolder() (MAPI)

Mark Hammond-4
On 14/04/2012 3:19 PM, Sriram ET. wrote:
> I have a folder in the Root Folder of a message store that I am trying
> to clear using EmptyFolder(). The code is as follows:
>
>                  folder = store.OpenEntry(eid, None, MOD_FLAG)
>                  hr = folder.EmptyFolder(0, None, 0)
>
> I get the error: ' Error: unsupported operand type(s) for &: 'NoneType'
> and 'int'

I'm afraid I can't explain that at all - None should be fine there and
nothing in the MAPI support should be trying to do the & - are you sure
the traceback points there.

>
> Changing the code to
>
>                  folder = store.OpenEntry(eid, None, MOD_FLAG)
>                  hr = folder.EmptyFolder(0, 0, 0)
>
> I get the following exception: "Error: The Python instance can not be
> converted to a COM object"

That's not a great message but is expected.

Mark

>
> This is a command line tool, and I do not need the progress of the
> operation. Can someone tell me what is the correct way to invoke
> EmptyFolder()?
>
> Thanks,
> Sriram
>
>
> _______________________________________________
> python-win32 mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/python-win32
>


_______________________________________________
python-win32 mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-win32
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error trying to do a EmptyFolder() (MAPI)

Sriram Karra
On Tue, Apr 17, 2012 at 6:55 AM, Mark Hammond <[hidden email]> wrote:
On 14/04/2012 3:19 PM, Sriram ET. wrote:
I have a folder in the Root Folder of a message store that I am trying
to clear using EmptyFolder(). The code is as follows:

                folder = store.OpenEntry(eid, None, MOD_FLAG)
                hr = folder.EmptyFolder(0, None, 0)

I get the error: ' Error: unsupported operand type(s) for &: 'NoneType'
and 'int'

I'm afraid I can't explain that at all - None should be fine there and nothing in the MAPI support should be trying to do the & - are you sure the traceback points there.

I am sorry, my bad. I tried to process a non-existent error code causing some problems. There was no issue with the routine itself.

Regards,
Sriram 

_______________________________________________
python-win32 mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-win32
Loading...