|
|
|
date: Tue, 02 Aug 2005 02:39:02 -0400,
group: microsoft.public.exchange2000.development
back
Re: Global Event Sink
Hello melbin,
your first three steps are fine.
Now the registration:
cscript RegEvent.vbs Add "OnSyncSave;OnSyncDelete" BIA_Exchange.Events.1
"file://./backofficestorage/domain/mbx/SystemMailbox{GUID}StoreEvents/GlobalEvents/globalSynchReg.eml"
-m ANY
The "BIA_Exchange.Events.1" is the ProgID of your component.
The url is the path where your event is registered. First: for global event
sinks, you must use the administrative namespace:
file://./backofficestorage/admin/<defaultdnsdomain>/mbx/SystemMailbox<guid>/StoreEvents/GlobalEvents/<sinkname>
You must replace these things:
<defaultdnsdomain> Your default smtp dns domain
<guid> The guid of the system mailbox. You can get this guid
from the Systems Manager: Navigate to the Mailbox Store\Mailboxes node of
storage group on which you want to create the event registration, and look
for the SystemMailbox<guid>. Replace the <guid> value above with the guid of
the systemmailbox.
<sinkname> The name of the sink. This name is entirely up to
you... how you would like the event te named.
Hope this helps,
Henning Krause
MVP - Exchange
http://www.infinitec.de
"melbinmathew" wrote in message
news:50ef2ba75912b2ce1edb7daa413ef26a@localhost.talkaboutsoftware.com...
>I want to get the notification when a message is deleted/read for about
> 40,000 mailboxes. For this i am using global event sink.
> The steps i am following,
> 1. Create an ATL COM application and implement the OnSyncSave and
> OnSyncDelete events.
> 2. Register it using Regsvr32
> 3. Create a COM+ application and register the components
> 4. CScript. Here i have the doubts.
>
>
> cscript RegEvent.vbs Add "OnSyncSave;OnSyncDelete" \
> BIA_Exchange.Events.1 "file://./backofficestorage/domain/mbx \
> /SystemMailbox{GUID}StoreEvents/GlobalEvents/globalSynchReg.eml" \
> -m ANY
>
> Here RegEvent.vbs is there in exchange SDK.
> A) Then since i am using DLL instead of "BIA_Exchange.Events.1", if the
> name of my dll is MyDll,i have to give like MyDll.SyncEvents right?
> Then domain i understood.
> B) How will i get the GUID, ?
> C) Then the "globalSynchReg.eml" is for what?
>
>
> Thanks in Advance
> Melbin
>
>
>
date: Tue, 2 Aug 2005 18:03:29 +0200
author: Henning Krause [MVP - Exchange]
Re: Global Event Sink
I did registration. Everything is fine except that i am not getting the
Events. I tried to sent the message to a mail account when an event
occured. But only when i tried to register another event sink i got
message telling that "file://./backofficestorage....." saved. When a
message is deleted/read i am not getting any messages. Will you please
check the following code,
HRESULT SendMail(const BSTR& bstrTo, const BSTR& bstrFrom, const BSTR&
bstrSubject,const BSTR& bstrTextBody);
// This is where the To and From fields of the message that you send will
be located.
CComBSTR bstrTo = OLESTR("sampleuser");
CComBSTR bstrFrom = OLESTR("system");
// These will be used to hold the body of the message.
CComBSTR bstrMsgText;
CComBSTR bstrMsgTextSync;
CComBSTR bstrMsgTextType;
HRESULT SendMail(const BSTR& bstrTo, const BSTR& bstrFrom, const BSTR&
bstrSubject,const BSTR& bstrTextBody)
{
IMessagePtr iMsg(__uuidof(Message));
HRESULT hr;
// IMessagePtr iMsg(__uuidof(Message));
// Set up a reply.
//iMsg->To="sampleuser@mks.com";
iMsg->put_From(bstrFrom);
// Set the recipient to the sender of the message that caused the event.
iMsg->put_To(bstrTo);
// Set up the subject string to contain the subject of the message that
caused the event.
iMsg->put_Subject(bstrSubject);
// Set up the text of the message to contain the URL to the message that
caused the event.
iMsg->put_TextBody(bstrTextBody);
// Send the message.
hr = iMsg->Send();
return 1;
}
STDMETHODIMP CEvents::OnSyncSave(IExStoreEventInfo * pEventInfo, BSTR
bstrURLItem, LONG lFlags)
{
HRESULT hr;
bstrMsgTextSync = "";
bstrMsgTextType = "";
bstrMsgText = "";
// Determine the phase of the event.
if (lFlags & EVT_SYNC_ABORTED)
// The event item was aborted.
bstrMsgTextSync = OLESTR("The EVT_SYNC_ABORTED bit is set.\n\n ");
else if (lFlags & EVT_SYNC_BEGIN)
// The event item has begun.
bstrMsgTextSync = OLESTR("The EVT_SYNC_BEGIN bit is set.\n\n ");
else // (lFlags & EVT_SYNC_COMMITTED)
// The event item has been committed.
bstrMsgTextSync = OLESTR("The EVT_SYNC_COMMITTED bit is set.\n\n ");
bstrMsgText.Append(bstrMsgTextSync);
// Determine the cause of the event.
if (lFlags & EVT_MOVE)
// The event item was saved as a result of a move.
bstrMsgTextType = OLESTR("The following item was saved as a result of a
move: ");
else if (lFlags & EVT_COPY)
// The event item was saved as a result of a copy.
bstrMsgTextType = OLESTR("The following item was saved as a result of a
copy: ");
else if (lFlags & EVT_IS_DELIVERED)
// The Event item was saved as a result of a message delivery.
bstrMsgTextType = OLESTR("The following item was saved as the result of
a message delivery: ");
else
// The event was fired by something other than the preceding
enumerations.
bstrMsgTextType = OLESTR("The following item was saved: ");
// Set up variables for the send mail function.
CComBSTR bstrMsgSubject = OLESTR("Sync OnSyncSave Event Fired ");
// Assign text to the message that will be sent.
bstrMsgText.Append(bstrMsgTextType);
bstrMsgText.Append(bstrURLItem);
// Send mail.
hr = SendMail(bstrTo,bstrFrom,bstrMsgSubject,bstrMsgText);
return hr;
}
STDMETHODIMP CEvents::OnSyncDelete(IExStoreEventInfo * pEventInfo, BSTR
bstrURLItem, LONG lFlags)
{
HRESULT hr;
// Determine the cause of the event.
if (lFlags & EVT_MOVE)
// The event item was deleted as a result of a move.
bstrMsgText = OLESTR(" The following item was moved: ");
else if (lFlags & EVT_HARDDELETE)
// The event item was permanently deleted.
bstrMsgText = OLESTR(" The following item was permanently deleted: ");
else if (lFlags & EVT_SOFTDELETE)
// The event item was moved to a temporary holding place.
bstrMsgText = OLESTR(" The following item was moved to a temporary
holding place: ");
else
// The event item was deleted.
bstrMsgText = OLESTR(" The following item was deleted: ");
// Set up variables for the send mail function.
CComBSTR bstrMsgSubject = OLESTR("Async OnDelete Event Fired ");
// Assign text to the message that will be sent.
bstrMsgText.Append(bstrURLItem);
// Send mail.
hr = SendMail(bstrTo,bstrFrom,bstrMsgSubject,bstrMsgText);
return hr;
}
Also when adding the components to the COM+ application i used the
"Install new component" and gave my DLL.Is it that correct?
Also i gave the ProgID of the component as the name which i got when i
expanded the component folder after i registered the DLL. Is that also
coorect?
Thanks a lotz in Advance
Melbin
date: Wed, 03 Aug 2005 03:01:00 -0400
author: melbinmathew
Re: Global Event Sink
I did registration. Everything is fine except that i am not getting the
Events. I tried to sent the message to a mail account when an event
occured. But only when i tried to register another event sink i got
message telling that "file://./backofficestorage....." saved. When a
message is deleted/read i am not getting any messages. Will you please
check the following code,
HRESULT SendMail(const BSTR& bstrTo, const BSTR& bstrFrom, const BSTR&
bstrSubject,const BSTR& bstrTextBody);
// This is where the To and From fields of the message that you send will
be located.
CComBSTR bstrTo = OLESTR("sampleuser");
CComBSTR bstrFrom = OLESTR("system");
// These will be used to hold the body of the message.
CComBSTR bstrMsgText;
CComBSTR bstrMsgTextSync;
CComBSTR bstrMsgTextType;
HRESULT SendMail(const BSTR& bstrTo, const BSTR& bstrFrom, const BSTR&
bstrSubject,const BSTR& bstrTextBody)
{
IMessagePtr iMsg(__uuidof(Message));
HRESULT hr;
// IMessagePtr iMsg(__uuidof(Message));
// Set up a reply.
//iMsg->To="sampleuser@mks.com";
iMsg->put_From(bstrFrom);
// Set the recipient to the sender of the message that caused the event.
iMsg->put_To(bstrTo);
// Set up the subject string to contain the subject of the message that
caused the event.
iMsg->put_Subject(bstrSubject);
// Set up the text of the message to contain the URL to the message that
caused the event.
iMsg->put_TextBody(bstrTextBody);
// Send the message.
hr = iMsg->Send();
return 1;
}
STDMETHODIMP CEvents::OnSyncSave(IExStoreEventInfo * pEventInfo, BSTR
bstrURLItem, LONG lFlags)
{
HRESULT hr;
bstrMsgTextSync = "";
bstrMsgTextType = "";
bstrMsgText = "";
// Determine the phase of the event.
if (lFlags & EVT_SYNC_ABORTED)
// The event item was aborted.
bstrMsgTextSync = OLESTR("The EVT_SYNC_ABORTED bit is set.\n\n ");
else if (lFlags & EVT_SYNC_BEGIN)
// The event item has begun.
bstrMsgTextSync = OLESTR("The EVT_SYNC_BEGIN bit is set.\n\n ");
else // (lFlags & EVT_SYNC_COMMITTED)
// The event item has been committed.
bstrMsgTextSync = OLESTR("The EVT_SYNC_COMMITTED bit is set.\n\n ");
bstrMsgText.Append(bstrMsgTextSync);
// Determine the cause of the event.
if (lFlags & EVT_MOVE)
// The event item was saved as a result of a move.
bstrMsgTextType = OLESTR("The following item was saved as a result of a
move: ");
else if (lFlags & EVT_COPY)
// The event item was saved as a result of a copy.
bstrMsgTextType = OLESTR("The following item was saved as a result of a
copy: ");
else if (lFlags & EVT_IS_DELIVERED)
// The Event item was saved as a result of a message delivery.
bstrMsgTextType = OLESTR("The following item was saved as the result of
a message delivery: ");
else
// The event was fired by something other than the preceding
enumerations.
bstrMsgTextType = OLESTR("The following item was saved: ");
// Set up variables for the send mail function.
CComBSTR bstrMsgSubject = OLESTR("Sync OnSyncSave Event Fired ");
// Assign text to the message that will be sent.
bstrMsgText.Append(bstrMsgTextType);
bstrMsgText.Append(bstrURLItem);
// Send mail.
hr = SendMail(bstrTo,bstrFrom,bstrMsgSubject,bstrMsgText);
return hr;
}
STDMETHODIMP CEvents::OnSyncDelete(IExStoreEventInfo * pEventInfo, BSTR
bstrURLItem, LONG lFlags)
{
HRESULT hr;
// Determine the cause of the event.
if (lFlags & EVT_MOVE)
// The event item was deleted as a result of a move.
bstrMsgText = OLESTR(" The following item was moved: ");
else if (lFlags & EVT_HARDDELETE)
// The event item was permanently deleted.
bstrMsgText = OLESTR(" The following item was permanently deleted: ");
else if (lFlags & EVT_SOFTDELETE)
// The event item was moved to a temporary holding place.
bstrMsgText = OLESTR(" The following item was moved to a temporary
holding place: ");
else
// The event item was deleted.
bstrMsgText = OLESTR(" The following item was deleted: ");
// Set up variables for the send mail function.
CComBSTR bstrMsgSubject = OLESTR("Async OnDelete Event Fired ");
// Assign text to the message that will be sent.
bstrMsgText.Append(bstrURLItem);
// Send mail.
hr = SendMail(bstrTo,bstrFrom,bstrMsgSubject,bstrMsgText);
return hr;
}
Also when adding the components to the COM+ application i used the
"Install new component" and gave my DLL.Is it that correct?
Also i gave the ProgID of the component as the name which i got when i
expanded the component folder after i registered the DLL. Is that also
coorect?
Thanks a lotz in Advance
Melbin
date: Wed, 03 Aug 2005 03:01:18 -0400
author: melbinmathew
|
|