c# - Save an exception on an Outlook add-in -
i trying programmatically change items of recurrence (and make exceptions).
the project outlook 2010 addin.
i tried following code after couple of saves code exited @ calitm.save()
command
extracted ="somelocation" //that's fancy way iterate on list of appointment items (int = 0; < filterappointmentstochangelocation.recordcount; i++) { int selrow = 1 var calitm = filterappointmentstochangelocation.data[selrow].getolappointment(); //this returns appointmentitem associated form //that contains location property calitm.userproperties["location"].value = extracted; calitm.save(); marshal.releasecomobject(calitm); }
do have suggestions? thnx time...
if code exists means crashing during call save method.
you need try/catch faulting code can save/rethrow exception
for (int = 0; < filterappointmentstochangelocation.recordcount; i++) { int selrow = 1 var calitm = filterappointmentstochangelocation.data[selrow].getolappointment(); try { calitm.userproperties["location"].value = extracted; calitm.save(); } catch (exception e) { // save, output or retrhow exception. system.io.file.writealltext (@"c:\somepath\error.txt", e.message); } marshal.releasecomobject(calitm); }
Comments
Post a Comment