none
Add tag to outgoing emails RRS feed

  • Question

  • Hi,

    My team uses outlook as an inquiry system. I'm building reporting around number of emails received and sent on a daily basis. I'm also looking to understand how many touch points there are to an email received or email sent under different threads.

    My idea is to add a unique id to any email sent out so that regardless the back and forth with that specific email, Outlook will recognize the email already has a unique id and will not create a new one for that email. It would be great if a unique id could also be created for every received email but don't know if this is possible if no further response is sent on that email.

    At the moment I use the conversation field to assist with this but its not accurate enough for me.

    Can anyone advise if this is possible? I see some software like "Bells and Whistles" out there but its justs keeps adding a unique id everything you go back and forth on the same email thread so therefore making it impossible to know how many touchpoints there was to that thread.

    I like to add VBA code to outlook to do this for me and add this unique id to the subject line so that when I export the data to excel, I can then run formulaes to provide me this information.

    Appreciate any help anyone can give me.

    Thanks,

    Ed

    Sunday, August 7, 2016 11:27 AM

Answers

  • Hi Ed,

    >> It works fine in my personal mailbox but not in my shared mailbox.

    To check whether the rule did not work for shared mailbox or the script did not work for mailbox, I suggest you create a simple script, and use a new rule with this script in shared mailbox.

    >> If an ID already is on the subject line of the email, I want the code to do nothing. If no ID exists, I want it to add the ID

    For this, I think you could try InStr to check whether ID exist in subject. Something like below:

    Public Function Contains(strBaseString As String, strSearchTerm As String) As Boolean
    'Purpose: Returns TRUE if one string exists within another
    On Error GoTo ErrorMessage
        Contains = InStr(strBaseString, strSearchTerm)
    Exit Function
    ErrorMessage:
    MsgBox "The database has generated an error."
    End
    End Function

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Wednesday, August 10, 2016 6:35 AM

All replies

  • Hello Ed,

    Of course, the most easiest way is to modify the Subject property by adding your own ID. Also you may consider setting a low-level property - PR_COMMENT. The PropertyAccessor class will help you with setting or getting values.       

    See Getting Started with VBA in Outlook 2010 for more information.   


    [custom.development]

    Sunday, August 7, 2016 7:49 PM
  • Thanks Eugene,

    Would you know of VBA code to complete the above? Given I want this code to be installed for my team, I want to ensure that it doesn't duplicate the unique id and also can handle multiple users opening an email and potentially responding on that email also. For this, I don't know whether code should be written in each individuals visual basic window or at the exchange level? The mailbox the team is working off is a shared mailbox.

    I might be over complicating this but it appears when faced with multiple users completing this task it adds a layer of complexity to it.

    appreciate your help.

    Regards,

    Ed

    Monday, August 8, 2016 5:50 AM
  • I came across the below code which works well when one user is managing the mailbox but I would like to alter this that it creates the file number automatically for me, retains a register of this file numbers not to duplicate them and has the ability to share that register with multiple people so that it doesn't duplicate the file number also?

    Sub AddFileNumber()
    Dim aItem As Object
     
    ' Don't forget the function
    Set aItem = GetCurrentItem()
     
    Dim iItemsUpdated As Integer
    Dim strTemp As String
    Dim strFilenum As Variant

         
    ' removed the loop so it only works with the selected item
    strFilenum = InputBox("Enter the file number")

    ' Empty value or cancel button
    If strFilenum = False Then Exit Sub
    If strFilenum = "" Then Exit Sub

    strTemp = "[" & strFilenum & "] " & aItem.Subject
        aItem.Subject = strTemp
        aItem.Save
     
     
    End Sub
    Function GetCurrentItem() As Object
        Dim objApp As Outlook.Application
              
        Set objApp = Application
        On Error Resume Next
        Select Case TypeName(objApp.ActiveWindow)
            Case "Explorer"
                Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
            Case "Inspector"
                Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
        End Select
          
        Set objApp = Nothing
    End Function

    Monday, August 8, 2016 7:17 AM
  • Think this code is better, but can't get it to work in the shared mailbox:

    Sub SubjectNumbering(Item As Outlook.MailItem)
     Dim sAppName As String
     Dim sSection As String
     Dim sKey As String
     Dim lRegValue As Long
     Dim lFormValue As Long
     Dim iDefault As Integer
     sAppName = "Outlook"
     sSection = "Messages"
     sKey = "Current Number"

    ' The default starting number.
         iDefault = 101 ' adjust as needed
     
     ' Get stored registry value, if any.
         lRegValue = GetSetting(sAppName, sSection, sKey, iDefault)
     
     ' If the result is 0, set to default value.
         If lRegValue = 0 Then lRegValue = iDefault
     
     ' Increment and update invoice number.
         SaveSetting sAppName, sSection, sKey, lRegValue + 1
     
     Item.Subject =  CStr(lRegValue) & " " & item.subject
     Item.Save
     
    End Sub

    Monday, August 8, 2016 7:35 AM
  • Ed,

    Where and when do you call the sub listed above?

    Basically you need to replace the ID if it already exist on the message. So, before adding a new ID to the message you need to check for existing one, and replace the value if it exists.


    [custom.development]

    Monday, August 8, 2016 8:15 AM
  • Hi,

    I created a rule for any email sent to a specific address, and added run a script to this rule. It works fine in my personal mailbox but not in my shared mailbox. Don't understand why? Can you assist? Do I need to change the account settings to have the shared mailbox as my default?

    I don't want to replace the ID if it already exists. If an ID already is on the subject line of the email, I want the code to do nothing. If no ID exists, I want it to add the ID. Do you know how I can alter the above to do this? Sorry my VBA is basic so I need assistance with this.

    Really appreciate your help.

    Ed

    Monday, August 8, 2016 9:03 AM
  • Hi Ed,

    >> It works fine in my personal mailbox but not in my shared mailbox.

    To check whether the rule did not work for shared mailbox or the script did not work for mailbox, I suggest you create a simple script, and use a new rule with this script in shared mailbox.

    >> If an ID already is on the subject line of the email, I want the code to do nothing. If no ID exists, I want it to add the ID

    For this, I think you could try InStr to check whether ID exist in subject. Something like below:

    Public Function Contains(strBaseString As String, strSearchTerm As String) As Boolean
    'Purpose: Returns TRUE if one string exists within another
    On Error GoTo ErrorMessage
        Contains = InStr(strBaseString, strSearchTerm)
    Exit Function
    ErrorMessage:
    MsgBox "The database has generated an error."
    End
    End Function

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Wednesday, August 10, 2016 6:35 AM