Hi,
I'm writing an MA to do Lync provisioning, and I want the MA to throw an Exception if there is an error (either during import or export), but to continue processing and not terminate the operation. For instance, if I have 3 users I want to add to Lync, and say any one of them is badly formatted, I want the MA to throw an exception only for that user but add the other 2 users.
In pseudocode, I have this for now
public PutExportEntriesResults PutExportEntries(IList<CSEntryChange> csentries) { foreach (CSEntryChange csentryChange in csentries) { try { // Add user to Lync
// On error
throw new ExtensibleExtensionException("Error occured");
} catch (Exception ex) { //handle exception } } }
This works in that it exports only the correct users, however it doesn't report anything back to the sync service (i.e. no export errors are seen in the console). I know this is probably because I'm handling the exception within the MA and not "leaking" it out, but if I don't handle it (i.e. remove the try catch block and just throw the exception), then all the adds fail since the exception then becomes an unhandled exception.
For 3 users (out of which 1 is incorrect), I would like to see 2 Adds and 1 exception shown in the console, but with the code above all I see is 3 adds and no errors (even though only 2 adds were performed in Lync).
How can I fix it so that I see the errors in the console?
Thanks