To change an item's message class with an Exchange Server script (solution) 
Author Message
 To change an item's message class with an Exchange Server script (solution)

This is follow up regarding my original post.  After posting my
request for help, I spent more time searching for answers in the
newsgroup and finally got the script to work.  Since I am not an
accomplished script writer, I thought I would share with others what I
did to get this simple script to work.

1.  Part of the problem was simply carelessness on my part.  When I
created the script in one of my Outlook public folders, I chose the
wrong Exchange Server.  My folder had only one replica and I did not
initially check in Exchange Administrator to see which Exchange Server
stored the public folder.  Once I chose the right server, I started to
get MicrosoftES messages in the event viewer of my Exchange Server
under applications.  However my script still did not work.

2.  I discovered that I was missing a small piece of code that I did
not see when I first found the script.  The code is:  objItem.Unread =
TRUE.  I don't know why this makes a difference, but it did.  Here's
my code now:
----Cut here-------
<SCRIPT RunAt=Server Language=VBScript>

'------------------------------------------------------------------------------
'FILE DESCRIPTION: Exchange Server Event Script
'------------------------------------------------------------------------------

Option Explicit

'------------------------------------------------------------------------------
' Global Variables
'------------------------------------------------------------------------------

'------------------------------------------------------------------------------
' Event Handlers
'------------------------------------------------------------------------------

Public Sub Folder_OnMessageCreated()

    Dim objSession

    Dim objItem

    Dim strMessageClass

    Dim objFolder

    strMessageClass = "IPM.Note.It Request Form"

    Set objSession = EventDetails.Session

    Set objItem = objSession.GetMessage(EventDetails.MessageID, Null)

    If objItem.Type <> "IPM.Note.IT Request Form" Then

        objItem.Type = "IPM.Note.IT Request Form"

        objItem.Unread = True

        objItem.Update

    End If

    Script.Response = FormatDateTime(Now()) & _
                      objItem.Subject & " updated to " & _
                      objItem.Type

    Set objSession = Nothing

    Set objItem = Nothing

End Sub

</SCRIPT>

----Cut here------

Now I am in business.  I would be interested in knowing why
"objItem.Unread = TRUE" made a difference.

Thanks.



Sat, 16 Oct 2004 22:48:43 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. To change an item's message class with an Exchange Server script

2. Changing the Outlook folder's default message class by VB6.0

3. Pls HELP about faxmodem solution with Exchange Server, NT and Crystal

4. Exporting Exchange messages w/CDO- script resources?

5. Copying calendar items to Exchange Server

6. Moving&Locating an item on the Exchange server

7. API for the new items from Outlook on Exchange Server

8. API for the new items from Outlook on Exchange Server

9. how to change the defult form for message delivery in Exchange

10. Error message displayed when reading the Exchange Server Mails

11. New_Mail Code creates 'Phantom' Message Items

12. Moving a message from Inbox to a folder in PST (No Exchange Server)

 

 
Powered by phpBB® Forum Software