A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to get the encrypted MailItem on OutLook2003?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 22nd 09, 10:13 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default How to get the encrypted MailItem on OutLook2003?

I need to process the MailItem when OnItemSend were triggered, So i make a
copy(MailItem-Copy) of MailItem, say it is CopyMailItem, then i saved
CopyMailitem(It may be encrypted or signatured, or may be both of them),
after use it, i need to delete this copy. But i couldn't get this
CopyMailItem while it is encrypted or signatured. What should i do to delete
the copy? The code is my attemption:
----------------------------
HRESULT CMyTest::HardDeleteMailItem(Outlook::_MailItemPtr & ItemPtr, BYTE
*pByte, int nByteLen)
{
HRESULT hResult = E_FAIL;
LPENTRYLIST lpTempList = NULL;

//Fill the ENTRYLIST
MAPIAllocateBuffer(sizeof(ENTRYLIST), (LPVOID*)&lpTempList);
if (lpTempList)
{
lpTempList-cValues = 1;
lpTempList-lpbin = NULL;
MAPIAllocateMore((ULONG)sizeof(SBinary), lpTempList, (LPVOID*)&lpTempList-
lpbin);

if (lpTempList-lpbin && pByte)
{
lpTempList-lpbin-cb = nByteLen;
MAPIAllocateMore(nByteLen, lpTempList, (LPVOID *)&lpTempList-lpbin-lpb);
if (lpTempList-lpbin-lpb)
{
CopyMemory(lpTempList-lpbin-lpb, pByte, nByteLen);
}
}
}
Outlook::_NameSpacePtr NameSpacePtr = ItemPtr-GetSession();
Outlook::MAPIFolderPtr pDraftFolderPtr = NameSpacePtr-GetDefaultFolder
(Outlook:lFolderDrafts);
if(pDraftFolderPtr == NULL)
{
MAPIFreeBuffer(lpTempList-lpbin-lpb);
MAPIFreeBuffer(lpTempList-lpbin);
MAPIFreeBuffer(lpTempList);
return E_FAIL;
}

IMAPIFolder * pFolder = NULL;
if(FAILED(pDraftFolderPtr-GetMAPIOBJECT()-QueryInterface(IID_IMAPIFolder,
reinterpret_castvoid**(&pFolder))))
{
MAPIFreeBuffer(lpTempList-lpbin-lpb);
MAPIFreeBuffer(lpTempList-lpbin);
MAPIFreeBuffer(lpTempList);
return E_FAIL;
}
//Hard Delete message
ULONG ulFlag = DEL_MESSAGES;
hResult = pFolder-DeleteMessages(lpTempList, NULL, NULL, ulFlag);
//Free memory
MAPIFreeBuffer(lpTempList-lpbin-lpb);
MAPIFreeBuffer(lpTempList-lpbin);
MAPIFreeBuffer(lpTempList);
return hResult;
----------------------------
But it will fail at pFolder-DeleteMessages, return value is 0x80040106
MAPI_E_UNKNOWN_FLAGS, I tried
#define DELETE_HARD_DELETE ((ULONG) 0x00000010)
ULONG ulFlag = DEL_MESSAGES | DELETE_HARD_DELETE;
too, returned the same error.
what's the wrong with my code? please help me.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200901/1

Ads
  #2  
Old January 22nd 09, 05:13 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to get the encrypted MailItem on OutLook2003?

DELETE_HARD_DELETE only works in the Exchange online store.
Have you tried to just pass 0?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:908f45689dd9d@uwe...
I need to process the MailItem when OnItemSend were triggered, So i make a
copy(MailItem-Copy) of MailItem, say it is CopyMailItem, then i saved
CopyMailitem(It may be encrypted or signatured, or may be both of them),
after use it, i need to delete this copy. But i couldn't get this
CopyMailItem while it is encrypted or signatured. What should i do to
delete
the copy? The code is my attemption:
----------------------------
HRESULT CMyTest::HardDeleteMailItem(Outlook::_MailItemPtr & ItemPtr, BYTE
*pByte, int nByteLen)
{
HRESULT hResult = E_FAIL;
LPENTRYLIST lpTempList = NULL;

//Fill the ENTRYLIST
MAPIAllocateBuffer(sizeof(ENTRYLIST), (LPVOID*)&lpTempList);
if (lpTempList)
{
lpTempList-cValues = 1;
lpTempList-lpbin = NULL;
MAPIAllocateMore((ULONG)sizeof(SBinary), lpTempList, (LPVOID*)&lpTempList-
lpbin);

if (lpTempList-lpbin && pByte)
{
lpTempList-lpbin-cb = nByteLen;
MAPIAllocateMore(nByteLen, lpTempList, (LPVOID *)&lpTempList-lpbin-lpb);
if (lpTempList-lpbin-lpb)
{
CopyMemory(lpTempList-lpbin-lpb, pByte, nByteLen);
}
}
}
Outlook::_NameSpacePtr NameSpacePtr = ItemPtr-GetSession();
Outlook::MAPIFolderPtr pDraftFolderPtr = NameSpacePtr-GetDefaultFolder
(Outlook:lFolderDrafts);
if(pDraftFolderPtr == NULL)
{
MAPIFreeBuffer(lpTempList-lpbin-lpb);
MAPIFreeBuffer(lpTempList-lpbin);
MAPIFreeBuffer(lpTempList);
return E_FAIL;
}

IMAPIFolder * pFolder = NULL;
if(FAILED(pDraftFolderPtr-GetMAPIOBJECT()-QueryInterface(IID_IMAPIFolder,
reinterpret_castvoid**(&pFolder))))
{
MAPIFreeBuffer(lpTempList-lpbin-lpb);
MAPIFreeBuffer(lpTempList-lpbin);
MAPIFreeBuffer(lpTempList);
return E_FAIL;
}
//Hard Delete message
ULONG ulFlag = DEL_MESSAGES;
hResult = pFolder-DeleteMessages(lpTempList, NULL, NULL, ulFlag);
//Free memory
MAPIFreeBuffer(lpTempList-lpbin-lpb);
MAPIFreeBuffer(lpTempList-lpbin);
MAPIFreeBuffer(lpTempList);
return hResult;
----------------------------
But it will fail at pFolder-DeleteMessages, return value is 0x80040106
MAPI_E_UNKNOWN_FLAGS, I tried
#define DELETE_HARD_DELETE ((ULONG) 0x00000010)
ULONG ulFlag = DEL_MESSAGES | DELETE_HARD_DELETE;
too, returned the same error.
what's the wrong with my code? please help me.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200901/1



  #3  
Old January 23rd 09, 02:24 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default How to get the encrypted MailItem on OutLook2003?

yes, i tried to just pass 0 to DeleteMessages, return error is
MAPI_W_PARTIAL_COMPLETION. Maybe it is because my type is POP3/SMTP.
What should i do then, just to delete this item completely? Please help me.

Dmitry Streblechenko wrote:
DELETE_HARD_DELETE only works in the Exchange online store.
Have you tried to just pass 0?

I need to process the MailItem when OnItemSend were triggered, So i make a
copy(MailItem-Copy) of MailItem, say it is CopyMailItem, then i saved

[quoted text clipped - 63 lines]
too, returned the same error.
what's the wrong with my code? please help me.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200901/1

  #4  
Old January 26th 09, 05:13 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to get the encrypted MailItem on OutLook2003?

Why do you assume that Drafts folder is the parent for the new item?
If anything it would be the Inbox. Or, even better, retrieve the parent
folder from the MailItem.Parent property.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:9097bfd7a9a1c@uwe...
yes, i tried to just pass 0 to DeleteMessages, return error is
MAPI_W_PARTIAL_COMPLETION. Maybe it is because my type is POP3/SMTP.
What should i do then, just to delete this item completely? Please help
me.

Dmitry Streblechenko wrote:
DELETE_HARD_DELETE only works in the Exchange online store.
Have you tried to just pass 0?

I need to process the MailItem when OnItemSend were triggered, So i make
a
copy(MailItem-Copy) of MailItem, say it is CopyMailItem, then i saved

[quoted text clipped - 63 lines]
too, returned the same error.
what's the wrong with my code? please help me.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200901/1



  #5  
Old January 29th 09, 02:11 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default How to get the encrypted MailItem on OutLook2003?

I'm sorry for reply so lately because of the Chinese New Year. Ok, let's
continue our discuss.
Thank you for your response.
Do you mean that if the Item's in inbox, then i can get this item even it
were encrypted?
I couldn't get your idea clearly, would you please explain it more detailed,
thank you.
One more question, what could i do with the item's parent folder? TIA.

Dmitry Streblechenko wrote:
Why do you assume that Drafts folder is the parent for the new item?
If anything it would be the Inbox. Or, even better, retrieve the parent
folder from the MailItem.Parent property.

yes, i tried to just pass 0 to DeleteMessages, return error is
MAPI_W_PARTIAL_COMPLETION. Maybe it is because my type is POP3/SMTP.

[quoted text clipped - 10 lines]
too, returned the same error.
what's the wrong with my code? please help me.


--
Message posted via http://www.officekb.com

  #6  
Old January 29th 09, 04:49 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to get the encrypted MailItem on OutLook2003?

What I meant is that the folder that you use to call
IMAPIFolder:eleteMessages() is always the Drats folder
(NameSpacePtr-GetDefaultFolder(Outlook:lFolderDrafts); and it is highly
unlikely that the actual parent fodler is Drafts.
..I was simply suggesting to try to use the actual parent folder,.which can
be retrieved from MailItem.Parent.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:90e3124d08f42@uwe...
I'm sorry for reply so lately because of the Chinese New Year. Ok, let's
continue our discuss.
Thank you for your response.
Do you mean that if the Item's in inbox, then i can get this item even it
were encrypted?
I couldn't get your idea clearly, would you please explain it more
detailed,
thank you.
One more question, what could i do with the item's parent folder? TIA.

Dmitry Streblechenko wrote:
Why do you assume that Drafts folder is the parent for the new item?
If anything it would be the Inbox. Or, even better, retrieve the parent
folder from the MailItem.Parent property.

yes, i tried to just pass 0 to DeleteMessages, return error is
MAPI_W_PARTIAL_COMPLETION. Maybe it is because my type is POP3/SMTP.

[quoted text clipped - 10 lines]
too, returned the same error.
what's the wrong with my code? please help me.


--
Message posted via http://www.officekb.com



  #7  
Old February 1st 09, 02:26 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default How to get the encrypted MailItem on OutLook2003?

Hi, Dmitry, I tried your suggestion, but it not work, the code is almost the
same as i posted before, just make a little change.
Change this:
Outlook::MAPIFolderPtr pDraftFolderPtr = NameSpacePtr-GetDefaultFolder
(Outlook:lFolderDrafts);
To:
Outlook::MAPIFolderPtr pDraftFolderPtr = ItemPtr-GetParent();
While i Call DeleteMessages(...), it failed with return value: 0x80040106
(Pass in DEL_MESSAGES or HARD_DELETE_MESSAGE flag) and 0x00040680(Pass in 0.).


Dmitry Streblechenko wrote:
What I meant is that the folder that you use to call
IMAPIFolder:eleteMessages() is always the Drats folder
(NameSpacePtr-GetDefaultFolder(Outlook:lFolderDrafts); and it is highly
unlikely that the actual parent fodler is Drafts.
.I was simply suggesting to try to use the actual parent folder,.which can
be retrieved from MailItem.Parent.

I'm sorry for reply so lately because of the Chinese New Year. Ok, let's
continue our discuss.

[quoted text clipped - 15 lines]
too, returned the same error.
what's the wrong with my code? please help me.


--
Message posted via http://www.officekb.com

  #8  
Old February 2nd 09, 04:50 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to get the encrypted MailItem on OutLook2003?

0x80040106 is MAPI_E_UNKNOWN_FLAGS
0x00040680 is MAPI_W_PARTIAL_COMPLETION

So essentially you are back to where you are started...


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:9108ea9f027de@uwe...
Hi, Dmitry, I tried your suggestion, but it not work, the code is almost
the
same as i posted before, just make a little change.
Change this:
Outlook::MAPIFolderPtr pDraftFolderPtr = NameSpacePtr-GetDefaultFolder
(Outlook:lFolderDrafts);
To:
Outlook::MAPIFolderPtr pDraftFolderPtr = ItemPtr-GetParent();
While i Call DeleteMessages(...), it failed with return value: 0x80040106
(Pass in DEL_MESSAGES or HARD_DELETE_MESSAGE flag) and 0x00040680(Pass in
0.).


Dmitry Streblechenko wrote:
What I meant is that the folder that you use to call
IMAPIFolder:eleteMessages() is always the Drats folder
(NameSpacePtr-GetDefaultFolder(Outlook:lFolderDrafts); and it is highly
unlikely that the actual parent fodler is Drafts.
.I was simply suggesting to try to use the actual parent folder,.which can
be retrieved from MailItem.Parent.

I'm sorry for reply so lately because of the Chinese New Year. Ok, let's
continue our discuss.

[quoted text clipped - 15 lines]
too, returned the same error.
what's the wrong with my code? please help me.


--
Message posted via http://www.officekb.com



  #9  
Old February 3rd 09, 08:22 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default How to get the encrypted MailItem on OutLook2003?

I use MFCMAPI to delete the encrypted message(with HARD_DELETE flag), it also
failed with MAPI_E_UNKNOWN_FLAGS.
But i choose the "Permanent deletion (deletes to deleted item retention if
supported)", it's ok, the message's gone. I trace the code, then trace my
code, finally i found that the error is caused by the message's entryid, my
entryid is not correct, now it is ok, thank you for your help!

Dmitry Streblechenko wrote:
0x80040106 is MAPI_E_UNKNOWN_FLAGS
0x00040680 is MAPI_W_PARTIAL_COMPLETION

So essentially you are back to where you are started...

Hi, Dmitry, I tried your suggestion, but it not work, the code is almost
the

[quoted text clipped - 20 lines]
too, returned the same error.
what's the wrong with my code? please help me.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200902/1

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
encrypted mails Sam Outlook - Using Forms 0 November 5th 07 06:47 PM
Accessing encrypted emails Pradeep Outlook and VBA 0 May 28th 07 06:53 AM
Force Encrypted PST [email protected] Outlook - General Queries 3 April 30th 07 02:57 PM
encrypted PST file Elijah Bass Outlook - General Queries 1 March 24th 06 11:04 PM
How can I create a MailItem that displays like a received MailItem ? Clive Outlook - Using Forms 0 February 27th 06 04:14 PM


All times are GMT +1. The time now is 09:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.