Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2006

Tip: Looking for answers? Try searching our database.

Problem getting UserGUID from Exchange OnSave event sink

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
timd - 15 Sep 2006 16:41 GMT
Hi, I suspect that this is an interop problem, can anyone help?

I'm having trouble getting the id of the user who caused an OnSave event on
a calendar appointment.  It is supposed to be available through the
IExStoreDispEventInfo interface but it just causes an exception.  

       **** EXCEPTION ****
       Catastrophic failure (Exception from HRESULT: 0x8000FFFF
(E_UNEXPECTED))
       **** STACKTRACE ****
          at Interop.Exevtsnk.IExStoreDispEventInfo.get_UserGuid()
          at EventSinkTest2.EventSinkTest.OnSave(IExStoreEventInfo evInfo,
String sURL, Int32 iFlags) in E:\Documents and
Settings\Administrator.EDIARY\My Documents\Visual Studio
2005\Projects\EventSinkTest2\EventSinkTest2\EventSinkTest.cs:line 105

Note that I'm using Csharp in VS 2005, and Exchange 2003.  The interop stuff
appears to be working because I can get other stuff  (eg: the EventRecord)
through the IExStoreDispEventInfo interface without any probem.  Here's the
code ... any suggestions?

using System;
using System.Collections.Generic;
using System.EnterpriseServices;
using System.Reflection;
using System.Runtime.InteropServices;
using System.IO;
using System.Text;
using ADODB;
using CDO;
using Exoledb;
using ExevtsnkLib = Interop.Exevtsnk;

namespace EventSinkTest2
{
   [Guid("5196E3E2-4CB3-4869-A72E-E69DC5E13F5C")]
   public class EventSinkTest : ServicedComponent,
ExevtsnkLib.IExStoreAsyncEvents
   {
       public void OnSave(ExevtsnkLib.IExStoreEventInfo evInfo, string
sURL, int iFlags)
       {
           try
           {
               if (System.Convert.ToBoolean(iFlags))
               {
                   CDO.Appointment appt = new CDO.AppointmentClass();
                   using (StreamWriter log =
File.AppendText(@"E:\EventReg\EventSinkTest.log"))
                   {
                       try
                       {
                           appt.DataSource.Open(sURL, null,
                               ADODB.ConnectModeEnum.adModeRead,
                               
ADODB.RecordCreateOptionsEnum.adFailIfNotExists,
                               ADODB.RecordOpenOptionsEnum.adOpenSource,
"", "");
                           ExevtsnkLib.IExStoreDispEventInfo dispInfo =
(ExevtsnkLib.IExStoreDispEventInfo)evInfo;
                           ADODB.Record oRecord = new ADODB.Record();
                           oRecord = (ADODB.Record)dispInfo.EventRecord;
                           log.WriteLine("Created by: " +
oRecord.Fields["http://schemas.microsoft.com/mapi/proptag/0x3FF8001E"].Value);
                           log.WriteLine("UserGUID: '" + dispInfo.UserGuid);
                       }
                       catch (Exception ex)
                       {
                           log.WriteLine("**** EXCEPTION ****");
                           log.WriteLine(ex.Message);
                           log.WriteLine("**** STACKTRACE ****");
                           log.WriteLine(ex.StackTrace);
                           Exception ina = ex.InnerException;
                           if (null != ina)
                           {
                               log.WriteLine("**** INNER EXCEPTION ****");
                               log.WriteLine(ina.Message);
                           }
                           throw (ex);
                       }
                   }
               }
           }
           catch (Exception ex)
           {
               throw (ex);
           }
       }
   }
}
"Peter Huang" [MSFT] - 18 Sep 2006 11:31 GMT
Hi,

Based on my understanding, you wanted to do Exchange Server side event sink
with OnSave event.
But when the event fired and you are trying to access the
dispInfo.UserGuid, you will get the error description per your post.
       **** EXCEPTION ****
       Catastrophic failure (Exception from HRESULT: 0x8000FFFF
(E_UNEXPECTED))
       **** STACKTRACE ****
          at Interop.Exevtsnk.IExStoreDispEventInfo.get_UserGuid()
          at EventSinkTest2.EventSinkTest.OnSave(IExStoreEventInfo evInfo,
String sURL, Int32 iFlags) in E:\Documents and
Settings\Administrator.EDIARY\My Documents\Visual Studio
2005\Projects\EventSinkTest2\EventSinkTest2\EventSinkTest.cs:line 105

From the exception, "Catastrophic failure" which is a general COM
exception, it is hard to guess what may be the problem.

But as your suspect, this may be a COM interop issue, to isolate the
problem, I suggest you try to sink the same event with a VBScript to see if
the problem persists.
Because to use C# to handle Event Sink, we need additional .NET com interop
library wrapper, to test with VBScript will help us to quick isolate the
problem is specific to the COM inteop layer
or the Exchange Server environment or configuration.

I will appreciate your efforts.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 20 Sep 2006 08:05 GMT
Hi,

I am writing to check how the thing is going one.
If you have any concern, please feel free to let me know.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
timd - 21 Sep 2006 17:20 GMT
> But as your suspect, this may be a COM interop issue, to isolate the
> problem, I suggest you try to sink the same event with a VBScript to see if
> the problem persists.

Well this generates an error -2147418113 with no description.  Here's the
code I used to test this ...

Sub ExStoreEvents_OnSave(ByVal evInfo, ByVal bUrl, ByVal iFlags)
  On Error Resume Next
  Dim fso, log, guid
  set fso = CreateObject("Scripting.FileSystemObject")
  set log = fso.OpenTextFile("E:\EventReg\vbs_event.log",8,true)
  log.WriteLine("Event fired at " & Now)
  log.WriteLine("URL = " & bUrl)
  set guid = evInfo.UserGUID
  log.WriteLine("UserGUID = " & guid)
  if err.number <> 0 then
     log.WriteLine("ERROR (" & err.number & "): " & err.description)
     err.clear
  end if
  log.WriteLine("---end---")
  log.close
  set log = nothing
  set fso = nothing
End Sub
"Peter Huang" [MSFT] - 22 Sep 2006 07:14 GMT
Hi,

Thanks for your efforts.
So far I wonder the problem may be the Exchange environment/configuration
issue.
You may try to use an account with administrator permission to test the
code.

Since this newsgroup is mainly focused on .NET interop programming, I would
suggest you post in the Exchange Dev newsgroup as a better alternative.
microsoft.public.exchange2000.development

However, this queue is not a MSDN managed queue yet. That means you won't
be guranteed to get a reply in 2 business days there. So if the issue is
urgent for you, I think the best way is to use one of your MSDN subscriber
free support incident to contact our customer support service. There will
be one Exchange dev support engineer working specially with you on it.
Please visit the following page for how to submit it:
http://msdn.microsoft.com/subscriptions/support/default.aspx

If you have any more concerns, please feel free to post here. Thanks very
much for your understanding.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
timd - 22 Sep 2006 09:50 GMT
Thanks for your help Peter, I'll try support.

-- Tim
Steven Cheng[MSFT] - 24 Sep 2006 13:55 GMT
Hi Tim,

Thanks for your posting. Regarding on this issue, Peter and I have
discussed with some other exchange engineer and it is an exchange server
specific issue. And due to the limited support surface of newsgroup, we
would recommend that you contact CSS for further troubleshooting.  Also, if
you meet any other .net specific developing problem or anything we can help
on this, please always feel free to post in the newsgroup.

Thanks again for your understanding!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 18 Sep 2006 11:34 GMT
Hi,

In addition, here is a link for your reference.
Implementing an OnSave Event Sink
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_ex
ch2k_implementing_an_onsave_event_sink.asp

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.