views:

8

answers:

1

Hey guys.

Okay, this is a little hard to explain, as the title might suggest.

I have an event receiver on ItemUpdated and ItemCheckedIn, which both writes custom SPAuditEntries. When CheckedIn occurs though - it comes with two update entries as well (one for added file, and one for a simple update to the list item I suspect).

I'd love to get rid of these entries. At first I thought it would be really simple, just put an if in the itemUpdated event receiver, and stop everything

if(SPListItem.CheckedOut = false) { //... do nothing }

However I couldn't find any way to ascertain the checkout-status of the listitem. My next thinking was, they hit almost at exactly the same time, so I could just crawl into the auditCollection, filter down to the specific listitem, user, and time (minus a second) and delete the two entries. But, sadly I found out I couldn't delete auditentries.

Anyone got any ideas?

+1  A: 

Checked out status is determined via:

if (item.Level == SPFileLevel.Checkout) {

where item is an SPListItem

-Oisin

x0n
Hmm... Okay. Well, if that's the case, I guess I need to ask for a different way to eliminate those two update entries. Because I just tried that checkout-block with no success :/
Dynde
I'm still a bit confused though - if you're using the auditing APIs, then sharepoint will audit the action regardless of what you do in an event receiver. So you have auditing turned off and you're manually creating entries?
x0n
No. The point of the event receiver/custom audit, is to add details about the action being audited (via audit.EventData). So auditing is turned on, and I'm manually creating custom entries, which I'm then going through in my custom scheduled job at a later time. The only problem is, that the checkin event follows two update entries. And it's annoying to have these two update entries every time something is checked in.
Dynde