Archive

Posts Tagged ‘ms-outlook’

Extending an automated testing infrastructure through an Outlook Add-In to save, rename email attachments into a searchable archive

  1. Begin confronted with on average 250 daily emailed notification files  per day, from varying sources – both custom test result messages and built-in default automation error messages –
  2. imageI resorted to writing an outlook add-in that stores these attachments in a central repository that can be searched – both names following a more meaning full naming convention, and full text – with more powerful (regular expression capable) tools, like grepWin:
  3. image

  4. The rules details evolved further, but here is an early version:
 
Public Sub SaveAttachmentsForSelectedMessagesToMyDocuments()
    Dim objOL As Outlook.Application
    Dim objMsg As Outlook.MailItem    'Object
    Dim objAttachments As Outlook.Attachments
    Dim objSelection As Outlook.Selection
    Dim I As Long
    Dim lngCount As Long
    Dim strFilePath As String
    Dim strFileName As String
    Dim strFolderPath As String
    Dim strDeletedFiles As String
    'add msgdate to atttachment
    Dim dtDate As Date
    Dim strFileExtendedName As String
    Dim strFileBasename As String
    Dim strExt As String
    Dim strSentTag As String
    Dim strSubject As String
    Dim strBody As String
    Dim strBasenamedate As String
    Dim strTESTCategory    'fail, warn, pass, finished=autom-error
    Dim allMatches As Object
    Dim objRE As Object
    Dim strTestnamefrombody As String



    ' Get the path to your My Documents folder
    strFolderPath = CreateObject("WScript.Shell").SpecialFolders(16)
    On Error Resume Next

    ' Instantiate an Outlook Application object.
    Set objOL = CreateObject("Outlook.Application")

    ' Get the collection of selected objects.
    Set objSelection = objOL.ActiveExplorer.Selection

    ' The attachment folder needs to exist
    ' You can change this to another folder name of your choice

    ' Set the Attachment folder.
    strFolderPath = strFolderPath & "\Outlook Files\"

    ' Check each selected item for attachments.
    For Each objMsg In objSelection 'msgs

        Set objAttachments = objMsg.Attachments
        lngCount = objAttachments.Count


        If (objMsg.SenderEmailAddress = "tdscautomation@gmail.com") And lngCount > 0 Then 'some other senders'mesages also end up in this folder
            strTESTCategory = ""
            strSourceCategory = ""
            Set objRE = CreateObject("vbscript.regexp")
            objRE.Global = True
            objRE.IgnoreCase = False
            objRE.Pattern = "(WARN|FAIL|PASS|finished)"    'ex: Testing Anywhere finished executing the test. / Version 5.2.1068 :- SQL03_TA_50 - STATUS= WARN / Version 5.2.1068 - System Tests - STATUS = PASS
            Set allMatches = objRE.Execute(objMsg.Subject)
            strTESTCategory = allMatches.Item(0).SubMatches.Item(0) + "~"

            objRE.Pattern = "(System|SQL03)"    'ex: Testing Anywhere finished executing the test. / Version 5.2.1068 :- SQL03_TA_50 - STATUS= WARN / Version 5.2.1068 - System Tests - STATUS = PASS / Version 5.2.1068 :- SQL03_TA_50 - STATUS= FAIL
            Set allMatches = objRE.Execute(objMsg.Subject)
            strSourceCategory = allMatches.Item(0).SubMatches.Item(0)
            If (LCase(strSourceCategory) = "system") Then
                strSourceCategory = "Server~"
            End If
            If (LCase(strSourceCategory) = "sql03") Then
                strSourceCategory = "Thinclient~"
            End If
            If (LCase(strSourceCategory) = "") Then
                strSourceCategory = "Testany~" ' correct: Testany~finished~Variable~sent-on~2016-02-12_18-39-21.txt
            End If

            objRE.IgnoreCase = True

            strSubjectOri = objMsg.Subject
            Debug.Print strSubjectOri
            
            

            For I = lngCount To 1 Step -1    'attachments
                ' Get the file name and other naming components for this attachment
                strFileName = objAttachments.Item(I).FileName
                strFileBasename = Mid(strFileName, 1, InStr(1, strFileName, ".") - 1)
                'Debug.Print strFileBasename
                strExt = Mid(strFileName, InStrRev(strFileName, "."), Len(strFileName))
                strBody = objMsg.Body
                dtDate = objMsg.SentOn    'add the msg date, to prevent overwriting undated files like testsuite.txt
                strSentTag = "~sent-on~" & Format(dtDate, "yyyy-mm-dd", vbUseSystemDayOfWeek, vbUseSystem) & "_" & Format(dtDate, "hh-mm-ss", vbUseSystemDayOfWeek, vbUseSystem)
                'excel can parse this date fromat to dtm , but not the time (all supported have chars illegal in filenames) - so go for sort and use excvel formula
                strSubject = ""    ' only 1 subject per message, but we don't check it for each attachment, and want it empty for some
                strBasenamedate = ""
                strTestnamefrombody = ""

                If (LCase(strExt) = ".zip") Then    'QA zip attachments don't indicate test script and date: we add from the subject (which does indicate) and msg
                    strSubject = Trim(strSubjectOri)
                    'strFileExtendedName = strSubject + strFileBasename + strSentTag + strExt
                Else
                    If (LCase(strExt) = ".txt") Then
                        If (LCase(strFileBasename) = "testsuite") Then    ' ex: attachment testsuite.txt"
                            'add no test name, since testsuite = summary for all tests
                            'add an extra ~ delimiter for excel column
                            'strSentTag = "~" + strSentTag
                            'todo: have to temp revert to regular send tag until i have more info about testsuite
                            'totest: sort by date asc: does not seem to work eith,er however, the testsuite is a mess anyway
                            'noworkie, saves from newest: so that most recent suite.txt overwrites previous summaries for this day (requires order by receiveddate desc display in outlook which is the norm)
                            'strFileExtendedName = strFileBasename + strSentTag + strExt
                            strSentTag = "~~sent-on~" & Format(dtDate, "yyyy-mm-dd", vbUseSystemDayOfWeek, vbUseSystem)    'using different strSentTag
                        Else    'not testsuite, but txt -> might (variable.txt) have a testname in the subject - split the tesname  out from what follows it
                        'todo: still
                            objRE.Pattern = "\_(January|February|March|April|May|June|July|August|September|October|November|December|\d{2,}\-)"    'need only start of datestring, for prepending delimiter
                            'done: not matching , is htis the inputSMAP_TestResult_50TA_02-07-2016_23_53_04

                            'no consistent formatmask: ex: SCE_OA_TestResult_50TA_02-11-2016_03_10_26
                            'BasicPDF_TestResult_50TA_01-04-2016 11_57_03.txt
                            'ST_HistoryTabs1_TestResult_SQL03_TA_50_January042016.txt
                             'ex: Testing Anywhere finished executing the test. / Version 5.2.1068 :- SQL03_TA_50 - STATUS= WARN / Version 5.2.1068 - System Tests - STATUS = PASS
                            Set allMatches = objRE.Execute(strFileBasename)
                            strBasenamedate = allMatches.Item(0).SubMatches.Item(0)
                            If (Len(strBasenamedate) > 0) Then strFileBasename = Replace(strFileBasename, "_" + strBasenamedate, "~" + strBasenamedate)  'todo:hack, use regex

                        End If
                    Else
                        If (LCase(strExt) = ".jpg") Then
                            If (LCase(strFileBasename) = "gogreen") Then    ' we know already, TU
                                GoTo NextIteration:    ' not having continueloop considered harmful
                            End If
                            'we do not seem to receive other jpg's?
                        Else
                            If (LCase(strExt) = ".png") Then
                                'TA's automation failure attachments have no originating script in filename, but the message body contains it
                                objRE.Pattern = "Test Name\s+:\s+(\S+)"    'ex: Test Name : Top10_INFO001.tamx
                                Set allMatches = objRE.Execute(strBody)
                                If allMatches.Count <> 0 Then
                                    strTestnamefrombody = allMatches.Item(0).SubMatches.Item(0)
                                End If
                            End If
                        End If
                    End If
                End If

                'components only initialized as "" will output nothing
                'prefer to add senton to all txt since even the ones that have a date have a hard to read/sort format mask
                ' add ~ as delimiters for  later parsing
                If (Len(strTestnamefrombody) > 0) Then
                    strTestnamefrombody = strTestnamefrombody + "~"
                End If
                If (Len(strSubject) > 0) Then
                    strSubject = strSubject + "~"
                End If
                strFileExtendedName = strSourceCategory + strTESTCategory + strTestnamefrombody + strSubject + strFileBasename + strSentTag + strExt
                strFileExtendedName = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(strFileExtendedName, "/", "_"), "\", "_"), "|", "_"), "<", "_"), ">", "_"), ":", "_"), "*", "_"), "?", "_"), """", "_"), "''", "_"), ",", "_"), " ", "_"), "__", "_"), "__", "_")
                ' Combine with the path to the folder.
                strFilePath = strFolderPath & strFileExtendedName
                If Dir(strFilePath) Then
                    If (FileLen(strFilePath) > objAttachments.Item(I).Size) Then
                    'todo: save attachment to temporary file  to compare sizes properly: keep only the largest = most recent one of undated files - should apply only testsuite.txt
                    Else
                    objAttachments.Item(I).SaveAsFile strFilePath
                    End If
                Else
                ' Save the attachment as a file.
                objAttachments.Item(I).SaveAsFile strFilePath
                End If
                'Debug.Print strFilePath + vbCrLf

NextIteration:
            Next I    'attachment
        End If 'if attachments
    Next    'message

ExitSub:

    Set objAttachments = Nothing
    Set objMsg = Nothing
    Set objSelection = Nothing
    Set objOL = Nothing
    Set objRE -= Nothing 
End Sub

Cancelling a meeting request in Outlook 2007

  1. Do not merely delete the meeting from your calendar;
  2. rather: open it and use the button: cancel meeting, like so: image

How to respond to a poll for the best meeting time using Meeting Requests

This 30-sec video shows how to cycle through optional meeting time slots: While keeping an eye on the (red underlined)  time slot currently polled, click green checkmark or red cross, you will be moved through the messages automatically:

Takes merely a minute, a few mouse clicks, hardly any mouse moves, and will clean up your inbox and send your vote to me at the same time.

How to make (and cancel) a room/resource booking without conflict by sending a meeting request from OWA and OUTLOOK–the ultimate training…

…using animated .gifs. Note the update for Outlook (desktop) users at the bottom. (Slower? Click the Links.)You can not only book lrcroomcoed434@uncc.edu like this, but any resource listed here.If you need the classroom repeatedly or other advanced features, read on.

To Book:

0.25sec,0.5sec, 0.75sec, 1sec, , 2sec, 3sec, 4sec, 5sec, 6sec, 7sec, 8sec, 9sec, 10sec. 1.5sec

To Cancel booking (why so?):

0.25sec,0.5sec, 0.75sec, 1sec, , 2sec, 3sec, 4sec, 5sec, 6sec, 7sec, 8sec, 9sec, 10sec.

Both book and cancel booking: Compact: 0.25sec,0.5sec, 0.75sec, 1sec, , 2sec, 3sec, 4sec, 5sec, 6sec, 7sec, 8sec, 9sec, 10sec. 1.5sec Or including unmarked frames: 0.25sec, 0.5sec, 0.75sec, 1sec, 1.5sec, 2sec, 3sec, 4sec, 5sec, 6sec, 7sec, 8sec, 9sec, 10sec.

And now in addition 2 screencasts (make/cancel reservation) for our OUTLOOK (desktop) users:

Have I reserved the LRC? 10 safety nets for you, plus a bonus

    1. No need to use them all: The first one you notice suffices. But we hope 1 of the 10 will work for you. Starting (that is why it is in explained in How to book LRC resources – explained in one screenshot: “Book me!”versus “Leave me alone!”) with the tab: scheduling assistant” in your “meeting requestitself before you try to book the room: It tells you when the room is free (white or blank along the timeline). Don’t try to book the room when the room’s timeline is not blank and the hovering tool tip tells you “Busy”: It is futile. scheduling-assistant busy
    2. But if you do, there will be more alerts: Immediately after you send the meeting request, a so-called “toast” (think of a slice of bread jumping out of a toaster – depending on email client you are using for NINERMAIL in the lower or upper right of the screen) flashes briefly with the automatic response from the room attendant. The response has in the subject : “Accepted or Denied” (you will not get “Tentative” from the room like in the example – UPDATE: only faculty and staff used to receive such toasts, but with the next upgrade of NINERMAIL, students will also!):room attentendant response as toast
    3. Never mind if you miss the toast: it just notified you that the automatic response from the room attendant went into your inbox. You can see it on top there (here I unfolded it). image It tells you in the subject and in bold in the body whether your booking was accepted or denied. If you have questions about these messages, you can forward them with your comment like any other email (no point in responding though).room attendant auto response declined  This does NOT remove the appointment from your own NINERRMAIL calendar (makes sense if you think about it: You still have your appointment (exam etc.), just the room can not be part of it).
    4. If you miss that also, go to the LRC homepage and click on “Hours&Events” under the Quick links in the upper left (How to view ?) imageimage
    5. You do not even need to visit the LRC home page: you have privileged access to the the LRC hours end events calendar  from your NINERMAIL, if you subscribe to it there (shortcut: start @ #3 armed with this link:http://mail.uncc.edu/owa/calendar/LRCRoomCOED434@uncc.edu/Calendar/calendar.ics).
    6. You can do all this under guidance at the LRC reception desk: We try to have 1-3 name-tagged student assistants there at all times during LRC opening hours, 8 eyes see more than 2.
    7. One day after your booking, you will also be able to see your reservation (if successful!) on the lrc-coed433-reception-client-welcome-screen: .
    8. If in doubt, do all this well before your class takes place.
    9. Take a training: ITS supports NINERMAIL and CTL teaches Taming your inbox.
    10. Bonus: In the unfortunate event of  a “Denied” response to your booking request, if it is not just an AM/PM error or similar which you can easily correct, the response includes information on the prior reservation, organizer, and email address.
      1. Why not email  the colleague (click on the underlined name of the colleague that booked the LRC before you) from right here and see whether you both can rearrange? Remember: Sharing is caring. room attendant response denied prior booking
      2. There is a departmental initiative to  reschedule entire classes that might conflict over the use of the LRC. Talk to the departmental office well before the the prior term ends (i.e. before next term’s class schedules are finalized).
      3. Still confused? At this point, talk to LRC permanent staff who will go through above list with you. Please understand that the LRC staff cannot cancel other faculty’s bookings, we only extended the availability and bookability of the LRC which is readily available and easily bookable at many times during each term.

OWA Calendar collaboration is spreading on campus…

… in Spring 2013 to Student Advising and Central Tutoring, from the LRC tutoring, staffing and room and equipment booking since Fall 2011. Glad to see that we get more benefit out of this new tool. 20130220_171700

Why do some room calendars refuse to synch in Outlook?

  1. Problem: I recently had to recreate ("Add calendar"/ "From address book") my calendar tree (groups) in Outlook 2010, and now I notice that
      1. some (especially all tutor "Room" calendars) steadfastly remain blank (e.g. LRCTutor07),
    1. while other room calendars do not (e.g. LRCRoomCOED433b).
  2. image
  3. The offending calendars can be loaded from internet (being published – with limited details, so that is not a real workaround): e.g. “ITL up t to 2201”.
  4. In the Properties/ Permissions, I can see that for some calendars that synch, I am not listed as Editor (presumably being more than that? Owner?) – but not all calendars that synch (e.g. LRCRoomCOED433b) have this as a requirement.
  5. image
  6. Is there maybe a limit of how many calendars can be loaded in Outlook at any given time?
  7. Impersonating the calendar and sharing it with myself does not help either: image
  8. In the settings below (albeit a year old), I cannot see a substantial difference either:

    type

    room

    Room

    shortname/type

    LRCRoomCOED433a

    LRCTutor07

    displayname

       

    PSComputerName

    rpitsexms1.its.uncc.edu

    rpitsexms1.its.uncc.edu

    RunspaceId

    fc10f102-74a8-4edb-ace5-d13662b8da3e

    fc10f102-74a8-4edb-ace5-d13662b8da3e

    AutomateProcessing

    AutoAccept

    AutoUpdate

    AllowConflicts

    TRUE

    TRUE

    BookingWindowInDays

    180

    180

    MaximumDurationInMinutes

    1440

    1440

    AllowRecurringMeetings

    TRUE

    TRUE

    EnforceSchedulingHorizon

    TRUE

    TRUE

    ScheduleOnlyDuringWorkHours

    FALSE

    FALSE

    ConflictPercentageAllowed

    0

    100

    MaximumConflictInstances

    0

    9999

    ForwardRequestsToDelegates

    TRUE

    TRUE

    DeleteAttachments

    TRUE

    TRUE

    DeleteComments

    FALSE

    FALSE

    RemovePrivateProperty

    TRUE

    TRUE

    DeleteSubject

    FALSE

    FALSE

    AddOrganizerToSubject

    TRUE

    TRUE

    DeleteNonCalendarItems

    TRUE

    TRUE

    TentativePendingApproval

    TRUE

    TRUE

    EnableResponseDetails

    TRUE

    TRUE

    OrganizerInfo

    TRUE

    TRUE

    ResourceDelegates

    Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.Directory.ADObjectId]

    Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.Directory.ADObjectId]

    RequestOutOfPolicy

    Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.Directory.ADObjectId]

    Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.Directory.ADObjectId]

    AllRequestOutOfPolicy

    FALSE

    FALSE

    BookInPolicy

    Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.Directory.ADObjectId]

    Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.Directory.ADObjectId]

    AllBookInPolicy

    TRUE

    FALSE

    RequestInPolicy

    Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.Directory.ADObjectId]

    Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.Directory.ADObjectId]

    AllRequestInPolicy

    FALSE

    TRUE

    AddAdditionalResponse

    TRUE

    TRUE

    AdditionalResponse

    <DIV><FONT face=Tahoma size=2>Faculty,staff&students in LCS/ELTI are the only users that can book this resource. If you do not qualify, please cancel your meeting request immediately and email instead LRChelp@uncc.edu with your request! </FONT></DIV>

    <DIV><FONT face=Tahoma size=2>LRC Staff (and possibly tutor-seeking students) in LCS are the only users that can book this resource. If you do not qualify, please cancel your meeting request immediately and email instead LRChelp@uncc.edu with your request! </FONT></DIV>

    RemoveOldMeetingMessages

    TRUE

    FALSE

    AddNewRequestsTentatively

    TRUE

    TRUE

    ProcessExternalMeetingMessages

    FALSE

    FALSE

    RemoveForwardedMeetingNotifications

    FALSE

    FALSE

    MailboxOwnerId

    its.uncc.edu/unccharlotte/Generic Accounts/LRCRoomCOED433a

    its.uncc.edu/unccharlotte/Generic Accounts/LRCTutor07

    Identity

    its.uncc.edu/unccharlotte/Generic Accounts/LRCRoomCOED433a

    its.uncc.edu/unccharlotte/Generic Accounts/LRCTutor07

    IsValid

    TRUE

    TRUE