Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Warn me when there is a duplicate followup.That has a exact Subject match.

Posted on 2009-07-03
17
Medium Priority
?
208 Views
Last Modified: 2012-05-07
Hi,

Warn me when there is a duplicate followup.That has a exact Subject match.
I click the followup flag red as to do jobs as and when i get and read the email. There are times when i click the followup on similiar mails. So when there is a match with the subject of just the followup mails then popup a box with the subject and say it has a duplicate.

Regards
Sharath
0
Comment
Question by:bsharath
  • 11
  • 5
17 Comments
 
LVL 28

Expert Comment

by:peakpeak
ID: 24805422
You might find some code to scratch from here:
http://www.outlookcode.com (download Sues code examples)
http://www.slovaktech.com/code_samples.htm
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24835428
sharath,

I may be able to do this, but I don't think the result will be practical.  Especially if you want it to search more than a few folders for items with matching subjects.  Unfortunately Outlook doesn't trigger a unique event when an item is flagged.  The best you can do is watch for the item changing when the flag is applied.  That's a little cumbersome.  Then there's the problem of searching for a duplicate.  Outlook's advanced search requires specifying the folders to search.  Searching a few folders, a half-dozen or less, isn't a problem, but searching dozens of folders would be.  Then there's the speed of the search to consider.  Searching one folder with a few hundred items is pretty quick, but searching thousands of messages spread across multiple folders is going to produce a very noticeable lag.  I just don't think it's very practical.

peakpeak,

You post the same information to a lot of questions.  You might as well post "Go search Google for an answer."  It doesn't help the author of the question.  You should at least take the time to search those sites for code that's relevant to what the person is asking.  I know your moto is "Never reinvent the Wheel. Use Google." and I agree with you that authors could answer a lot of their own questions by doing a simple search.  The fact is that folks are paying money to get help with a question not to be told to go search for it themselves.  It'd be like you taking your car to a mechanic to diagnose a problem and the mechanic telling you to look in an auto manual because he knows the answer is there.  
0
 
LVL 11

Author Comment

by:bsharath
ID: 24836863
Hi David,

The only place i want to check for Duplicate Subjecdts when flagged is the Mailbox (Inbox)
I will have 1 flagged already and if i flag the 2nd one then popup a box.

I guess this would be easier...
As once i comple all the jobs only then i Move the mails to my psts and relevant folders
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 11

Author Comment

by:bsharath
ID: 24836864
Hi David,

The only place i want to check for Duplicate Subjecdts when flagged is the Mailbox (Inbox)
I will have 1 flagged already and if i flag the 2nd one then popup a box.

I guess this would be easier...
As once i comple all the jobs only then i Move the mails to my psts and relevant folders
0
 
LVL 11

Author Comment

by:bsharath
ID: 24962106
Hi David any views on this
0
 
LVL 11

Author Comment

by:bsharath
ID: 25005476
Hi David any views....
0
 
LVL 11

Author Comment

by:bsharath
ID: 25066207
Hi David...Any views on this please...
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 25110063
This should do it.  This code goes in the ThisOutlookSession module.
Dim WithEvents olkExplorers As Outlook.Explorers
Dim WithEvents olkExplorer As Outlook.Explorer
Dim WithEvents olkItem As Outlook.MailItem
Dim bolDuplicateItem As Boolean
 
Private Sub Application_Quit()
    Set olkExplorers = Nothing
    Set olkExplorer = Nothing
    Set olkItem = Nothing
End Sub
 
Private Sub Application_Startup()
    Set olkExplorers = Application.Explorers
    Set olkExplorer = Application.ActiveExplorer
End Sub
 
Private Sub olkExplorer_Activate()
    Set olkExplorer = Application.ActiveExplorer
End Sub
 
Private Sub olkExplorer_SelectionChange()
    Set olkItem = Application.ActiveExplorer.Selection(1)
End Sub
 
Private Sub olkExplorers_NewExplorer(ByVal Explorer As Explorer)
    Set olkExplorer = Explorer
End Sub
 
Private Sub olkItem_PropertyChange(ByVal Name As String)
    If Name = "FlagStatus" Then
        If olkItem.FlagStatus = olFlagMarked Then
            bolDuplicateItem = IsDuplicate()
        End If
    End If
End Sub
 
Private Sub olkItem_Write(Cancel As Boolean)
    If bolDuplicateItem Then
        If msgbox("You already have an item with this subject flagged for action." & vbCrLf & "Flag anyway?", vbQuestion + vbYesNo, "Check for Flagged Duplicates") = vbNo Then
            Cancel = True
        Else
            Cancel = False
        End If
    End If
    bolDuplicateItem = False
End Sub
 
Function IsDuplicate() As Boolean
    Dim olkItems As Outlook.Items, olkMessage As Outlook.MailItem
    Set olkItems = Session.GetDefaultFolder(olFolderInbox).Items.Restrict("[Subject] = '" & olkItem.Subject & "'")
    For Each olkMessage In olkItems
        If olkMessage.FlagStatus = olFlagMarked Then
            If olkMessage.EntryID <> olkItem.EntryID Then
                IsDuplicate = True
                Exit For
            End If
        End If
    Next
    Set olkItems = Nothing
    Set olkMessage = Nothing
End Function

Open in new window

0
 
LVL 11

Author Comment

by:bsharath
ID: 25111406
Thanks David...
Mailed you the code...I get a sub error... Can you help combine my code with this code please...
0
 
LVL 76

Expert Comment

by:David Lee
ID: 25119512
Done.
0
 
LVL 11

Author Comment

by:bsharath
ID: 25119839
David i did add the code you gave and when i select the Flag on 2 identical Subject mails i get no warning...
0
 
LVL 76

Expert Comment

by:David Lee
ID: 25121375
Are the messages in the Inbox?
0
 
LVL 11

Author Comment

by:bsharath
ID: 25121384
Yes both the messages are in the inbox
0
 
LVL 76

Expert Comment

by:David Lee
ID: 25121409
Did you close and restart Outlook after adding the code?
0
 
LVL 11

Author Comment

by:bsharath
ID: 25121421
Yes i did restart... Just going to try a log off
0
 
LVL 11

Author Comment

by:bsharath
ID: 25121599
Thanks a lot David Worked perfect after a restart... :-)
0
 
LVL 11

Author Comment

by:bsharath
ID: 25121852
Hi David,

When i click on the deleted folder. I get the attached error. Can you please suggest

Capture.JPG
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
Take a look at these 6 Outlook Email management tools which can augment the working and performance of Microsoft Outlook to give you a more rewarding emailing experience.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question