Solved

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

Posted on 2009-07-03
17
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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 500 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

624 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