![]() |
|
|
| Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site | ||
|
|
WSS Version of IM Announcements to all user with an Exchange mailbox Download scripts This is a port of the script I described in a previous article IM Announcements to all user with a Exchange mailbox using an On_Arrival SMTP event sink. This version uses a WSS Async On_Save event sink and adds the functionality of a header for the announcement to say who it has come from. How it works I've used a two step approach to firing this event that adds a layer of abstraction for my Exchange event sinks. the event sink code look as follows it uses a Async onsave event sink. <SCRIPT LANGUAGE="VBScript"> Main Script Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
if I = 0 then
inbstr = objArgs(I)
else
inbstr = inbstr & " " & objArgs(I)
end if
Next
Dim ADODBRec
Set Rec = CreateObject("ADODB.Record")
rec.Open inbstr
message = "Annoucement from " & rec.Fields("urn:schemas:httpmail:sendername") & vbCrLf
message = message & " " & rec.Fields("urn:schemas:mailheader:subject")
set OU = GetObject("LDAP://CN=Users,DC=AD1")
dim strtest, loopexit
loopexit = 1
call sendmsg()
sub sendmsg()
strMsgHeader = "Mime-Version: 1.0" & vbCrLf & "Content-Type: text/plain; charset=UTF-8" & vbCrLf & vbCrLf
msgType = IM_MSG_TYPE_NO_RESULT
Set oIMApp = CreateObject("MSExchangeIM.MSIMHost")
Set oIMServ = oIMApp.CreateContext("Default", 0)
strtest = Array("newb1@exbend","newb1","pass","ad1")
oIMServ.logon strtest
do until iState = 2
oIMServ.GetLocalState iState, strState, strDescr
if loopexit = 1000 then
exit sub
end if
loopexit = loopexit + 1
loop
For Each oUser in OU
if oUser.Class = "user" then
if oUser.msExchIMAddress <> "" then
set oIMsession = oIMServ.CreateIMSession(oUser.msExchIMAddress)
oIMsession.Sendtext strMsgHeader, message, msgtype
On Error resume Next
End If
End If
Next
Set OU = Nothing
OIMServ.logoff()
set oIMApp = nothing
end sub
Registering this script For details on installing and registering this script see my previous article Using VBS Event Sink scripts with the Web Storage System. Or have a look in the ESDK search for regevent.vbs Download scripts |
|
|
|
Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Pro Exchange. OutlookExchange.Com and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.
© Copyright Pro Exchange, Inc., 2006