×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Outlook Macro in ThisOutlookSession Not staying signed due to modification...

Outlook Macro in ThisOutlookSession Not staying signed due to modification...

Outlook Macro in ThisOutlookSession Not staying signed due to modification...

(OP)
The subject about says it all.

I have macros saved in the default ThisOutlookSession module. I sign it. Exit Outlook. Open Outlook and it says the code has been modified, doesn't match the signature and that macros will be disabled. This is an Exchange hosted mailbox. The company I work at has a digital certificate server and I acquired mine there.

While I do have multiple clients that may hit my mailbox, it is only when I sign in and I am careful when testing not to access the mailbox between signed machine sessions which is where I ideally intend to exclusively use my mailbox. Meanwhile the code is becoming disabled on that machine because of the invalidated signature.

The code has a simple purpose. Put the received date of the message in the user field so I can group on it and then format received as time. Obviously I want it to run all the time.

I also realize it ideally should be running on different events since it is Exchange hosted and the event may not process correctly for big batches, hence my secondary procedure to fix but when I read about the issue I quickly put that on my to do list for if I ever get bored and is something I have to look up as it looked slightly involved...

My current thought is that maybe a server side security process is messing with it as at a glance it looks fine. This is an involved issue so my IT department will likely take a month to route the ticket appropriately, hence I am here hoping for some thoughts so I can steer them.

More on the outlook dialog and code below.

Quote (Outlook dialog excerpt)


Microsoft Office has identified a potential security concern.

Warning: The Digital signature has been tampered with after the content was signed. This content cannot be trusted.


CODE

Option Explicit

Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
  Dim olApp As Outlook.Application
  Dim objNS As Outlook.NameSpace
  Set olApp = Outlook.Application
  Set objNS = olApp.GetNamespace("MAPI")
  ' default local Inbox
  Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)

  On Error GoTo ErrorHandler
  Dim dtReceived As Date
  Dim objProp As Outlook.UserProperty
    
  Select Case TypeName(Item)
    Case "ReportItem" 'NDR's - Non Delivery Reports
        dtReceived = Item.CreationTime 'Looks like this is the "Received Date"
    Case Else 'MailItem and MeetingItem I definitely saw working
      dtReceived = Item.ReceivedTime
  End Select
  'MsgBox "Date Received is" & dtReceived 'Yes it is running
 'Property added below needs added to inbox view if you want to see or group on it
  Set objProp = Item.UserProperties.Add("ReceivedDateOnly", olDateTime, True)
  objProp.Value = DateSerial(Year(dtReceived), Month(dtReceived), Day(dtReceived))
  Item.Save 'item needs saved now that it has been updated
ProgramExit:
  Exit Sub
ErrorHandler:
  MsgBox Err.Number & " - " & Err.Description
  Resume ProgramExit
End Sub


Sub FixItems()
  Dim olApp As Outlook.Application
  Dim objNS As Outlook.NameSpace
  Dim olItems As Outlook.Items
  Dim Item As Object
  'Dim ReportItem As Outlook.ReportItem
  
  Dim dtReceived As Date
  Dim objProp As Outlook.UserProperty
  
  Set olApp = Outlook.Application
  Set objNS = olApp.GetNamespace("MAPI")
  ' default local Inbox
  Set olItems = objNS.GetDefaultFolder(olFolderInbox).Items
  
  For Each Item In olItems
    Select Case TypeName(Item)
      Case "ReportItem" 'NDR's - Non Delivery Reports
        dtReceived = Item.CreationTime 'Looks like this is the "Received Date"
      Case Else 'MailItem and MeetingItem I definitely saw working
        'Debug.Print TypeName(Item)
        dtReceived = Item.ReceivedTime
    End Select
    
    Set objProp = Item.UserProperties.Add("ReceivedDateOnly", olDateTime, True)
    objProp.Value = DateSerial(Year(dtReceived), Month(dtReceived), Day(dtReceived))
    Item.Save 'item needs saved now that it has been updated
SkipLoop:
  Next
  
End Sub 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close