Saturday, 15 October 2011

Extending and Overriding my own Wits

Well I am making some progress on that non-event from hell detailed in my last post. First I commented out everything in my event handler and put in some innocuous line like:

properties.ListItem("Title") = "Changed by the event handler";

And that worked. So my fears that the event handling code was not invoked at all when logging in as a non-admin, nothing special user were unfounded.

So, I commented back in the error handling code. Nothing happened. OK, so the error handler doesn't work. At least that explains why I wasn't getting any feedback. Strange given that the test user had access to the folders but not crucial but will worry about it later.

So what did I do then? Moved the comment /* indicator down a few painstaking lines each time, compiled, GACed, IISResetted and ran. Used the Title field as my error handler! Bit by bit by bit. The code had no problem calling the web service or using the impersonator token. What it did not want to do was copy the binarily streamed file (is that valid syntax? Probably not, but if the method of streaming a file is binary, then surely it is binarily streamed, no? Anyway.) It streamed it fine, even modified as Mr High-Up Impersonated User just as I asked it to with the SPUserToken. But it won't copy it.

I suspect I will have to put a Special Snowflake sodding privilege block around that operation all by itself or else it will sulk forever. So, will I succeed. Tune be continued in our next. If you haven't died of boredom first...

No comments:

Post a Comment