Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / January 2006

Tip: Looking for answers? Try searching our database.

Redemption - problem with Save

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin - 25 Jan 2006 10:30 GMT
I'm using Redemption to circumnavigate Outlook 2003 security on my setup
while using some code to handle new messages.  When I set the SafeItem.Item =
CurrentItem, I have to precursor this with a CurrentItem.Save so that I can
access some of the item's properties through the SafeItem object.  This works
fine, the only problem is if I ever decide to abort my message (i.e. close
and say No to saving) this obviously still leaves a stray copy of the message
in my Drafts from the earlier CurrentItem.Save.  Does anyone know of a way to
stop or fix this?
Martin - 25 Jan 2006 12:10 GMT
It's a bit clumsy but I've added the following to my Application_Startup
event as a solution.  Any suggestions/improvements gratefully received - or
preferably a way of doing this when the message is first created:

   Set myNS = Application.GetNamespace("MAPI")
   Set myItems = myNS.GetDefaultFolder(olFolderDrafts).Items
   myCount = myItems.Count
   For n = myCount To 1 Step -1
       Set myMail = myItems.Item(n)
       Set SafeItem.Item = myMail
       myStr = SafeItem.Body & SafeItem.SentOnBehalfOfName & SafeItem.Subject
       If SafeItem.Recipients.Count = 0 And SafeItem.Attachments.Count = 0
And myStr = "" Then myMail.Delete
       End If
   Next

> I'm using Redemption to circumnavigate Outlook 2003 security on my setup
> while using some code to handle new messages.  When I set the SafeItem.Item =
[quoted text clipped - 4 lines]
> in my Drafts from the earlier CurrentItem.Save.  Does anyone know of a way to
> stop or fix this?
Ken Slovak - [MVP - Outlook] - 25 Jan 2006 14:38 GMT
After you issue the Save command grab the EntryID of the item. If you want
to delete it get it as a Redemption item of some kind and delete it. Use
Redemption to do that so the item doesn't end up in the Deleted Items
folder.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> I'm using Redemption to circumnavigate Outlook 2003 security on my setup
> while using some code to handle new messages.  When I set the
[quoted text clipped - 9 lines]
> to
> stop or fix this?
Dmitry Streblechenko - 27 Jan 2006 00:31 GMT
One workaround could be to use a global (boolean) flag - implement the
Item_Write event hander. Set a global flag, call Save, Outlook will call
your implementation of the Item_Write event hander. If the flag is set, your
code is calling Save, otherwise it is the user explciitly saving the
message.
If the user never saved the message, it should be safe for you to delete it.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> I'm using Redemption to circumnavigate Outlook 2003 security on my setup
> while using some code to handle new messages.  When I set the
[quoted text clipped - 9 lines]
> to
> stop or fix this?
Martin - 31 Jan 2006 09:56 GMT
Thanks Dmitry - both for your response and for Redemption itself (which has
been a lifesaver!).  I've gone with a combination of flags, the Write event,
and the Close event to ensure dummy messages are deleted.  Not a complete
solution as Ken points out: they're still ending up in the Deleted Items
folder so I'll have to look more closely into the possibility of using
Redemption to fully delete.

> One workaround could be to use a global (boolean) flag - implement the
> Item_Write event hander. Set a global flag, call Save, Outlook will call
[quoted text clipped - 21 lines]
> > to
> > stop or fix this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.