You can subscribe to this discussion group using an RSS feed reader. Taglocity General Discussion Forum

All about Taglocity. Bug reports, Feature Requests and General Chat


Please feel free to put any sort of Taglocity comments in this forum. If it starts to grow too big then we can split it up into different areas.

Questions about this forum can go here

Forum guidelines are here

A wee green tick next to a username indicates an administrator or employee of IngBox Software

User Defined TagActions Example

As pointed out here: http://taglocity.com/fogbugz/default.asp?TaglocityGeneral.1.706.0 in the new 1.0.5 version for Outlook 2003, there is something of a 'beta' advanced feature called 'User Defined TagActions'.

In summary, what this is is the ability to run VBA Macro code (only signed and secure) as part of your tags set of 'TagActions'. You can set either an AutoTag or Manual tagging action to cause your own functions to run.

Obviously this kind of extensibility can be made to do some very powerful things. At the moment we are still thinking about the 'design time' experience of doing one of these, but the underlying engine is there to try now.

The easiest way to explain it is with an example. Here's a simple one:

(1) The goal of this action example is to only run the 'Move To Folder' type action, when the Outlook item is an email, i.e. do not move Tasks or Calendar items. This is a good realistic example, as it came in as a forum request, as you can see here: http://taglocity.com/fogbugz/default.asp?TaglocityGeneral.1.560.6

(2) First off you set up the name of your action in the underlying tags configuration store. This editing part will be made easier via a new Configuration UI in the future, but for now it involves editing your xml file manually. Please do these following steps:

(2.1) Shutdown Outlook - this prevents Taglocity overwriting your edits when Outlook closes.

(2.2) Find your tag name (or names, you can do many) that you want to associate the action with in your text configuration file. This information is stored in this text file here:

C:/Document and Settings/(UserName)/Application Data/IngBox Software/Taglocity/tagsconfig.xml

(Replace (username) and C drive with your own settings).

It is worth backing up your .xml file first too. Note: If you are storing your config inside Outlook, please edit your Journal entry 'Taglocity Settings'.

(2.3) In Notepad (or other text editor) for each tag you want to update, find the following element and update to the name of the VBA function you want to call on the 'action', i.e. change this:

 <Tag>
    <Name>Test</Name>
...
    <tagActionUserDefinedMacro />

to

 <Tag>
    <Name>Test</Name>
...
  <tagActionUserDefinedMacro>0;MoveOnlyEmails</tagActionUserDefinedMacro>

(The 0 or 1 before the first ';' indicate if the action should be run on AutoTag (1) or just Manually (0)). You can see that the function I want to run is called 'MoveOnlyEmails'.

(2.4) Save and exit the file. Restart Outlook

(3) Now let's use the Outlook VBA editor to add a Macro (Tools / Macros / Visual Basic Editor). Here's a simple one that does what we need (Note it expects the Outlook folder 'Inbox / JustEmail' to exist before running):

' Simple action to move only Mail items to a folder
Public Sub MoveOnlyEmails()

        ' The Explorer is the main Outlook window
        Set myExplorer = Application.ActiveExplorer
       
        ' What we have selected in Outlook
        Set Selection = myExplorer.Selection
       
        ' This part points to the destination folder, edit for your own Inbox/Foldername
        Set objNS = Application.GetNamespace("MAPI")
        Set objFolder = objNS.GetDefaultFolder(olFolderInbox)
        Set destinationFolder = objFolder.Folders("JustEmail")
       
        'May be one or more selected Outlook items to look at
        For Each thisMail In Selection
                   
            'Just move emails,not tasks or calendars etc
            If thisMail.Class = olMail Then
                'Move it!
                thisMail.Move destinationFolder
            End If
           
        Next

End Sub

Private Sub Application_Startup()
   
    ' Must include this part for the Macro to initialise
   
End Sub

(4) You will need to either sign the Macro with your own Id or lower Outlook's Macro security settings (not recommended).

For a fantastic resource for VBA and how to's, check out Sue Moshers wonderful Outlook site here: http://www.outlookcode.com/

(5) You can now try out your 'Test' tag, and see that it moves into the JustEmail folder beneath your default InBox folder.

We're working on the help guide, plus lots more examples, so comments and suggestions are really welcome for this feature.
David Ing (Recognized User) Send private email
Monday, January 22, 2007
Powered by FogBugz