{System.AccessViolationException: Attempted to read or write protected

Add-in Express™ Support Service
That's what is more important than anything else

{System.AccessViolationException: Attempted to read or write protected
{System.AccessViolationException: Attempted to read or write protected 
Sandeep Pulkundwar

Posts: 15
Joined: 2008-09-11
I am using Add-in Express for Office and .Net to develop an Outlook Addin.
I have added a ADX form. I want to access some properties of Outlook._Appointment object in that form. To access GlobalAppointmentID of the appointment i have added following property in AddInModule.

        public string OutlookAppID
                Outlook._Application app = Outlook._Application)HostApplication as Outlook._Application;

                return ((Outlook._AppointmentItem)app.ActiveInspector().CurrentItem).GlobalAppointmentID.ToString();

When i call this property i get an error
{System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Is there any other way to access Appointment object properties.

Thanks & Regards,
Sandeep Pulkundwar
Posted 07 Oct, 2008 09:26:03 Top
Eugene Astafiev

Add-in Express team

Posts: 8540
Joined: 2007-07-25
Hi Sandeep,

I have sent you a letter. Please check your Inbox.

Please try to release COM objects and always check the value of properties for null (Nothing in VB).

.NET, Extended MAPI, Windows Phone & RT
Posted 07 Oct, 2008 09:51:14 Top