Problem getting UserGUID from Exchange OnSave event sink
- From: timd <timd@xxxxxxxxxxxxxxxx>
- Date: Fri, 15 Sep 2006 08:41:02 -0700
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);
}
}
}
}
.
- Follow-Ups:
- RE: Problem getting UserGUID from Exchange OnSave event sink
- From: "Peter Huang" [MSFT]
- RE: Problem getting UserGUID from Exchange OnSave event sink
- From: "Peter Huang" [MSFT]
- RE: Problem getting UserGUID from Exchange OnSave event sink
- Prev by Date: RE: Excel interoperability problem
- Next by Date: Re: Reflection messing up the type hierarchy
- Previous by thread: RE: Excel interoperability problem
- Next by thread: RE: Problem getting UserGUID from Exchange OnSave event sink
- Index(es):