I have a Sharepoint 2010 farm in which is deployed my solution. This solution provides some "data mantain" of some content types. Let me explain:
Suppose I add a file in a document library: when I put it in the folder X, it write on the item that X is his father and has some particular properties.
This works fine, jumping around 4 event:
- Item Adding
- Item Adding
- Item CheckedIn
- Item Updated
Now I'm facing a problem: I have a 3rd party component that permits the move of the document from a document library to another, carrying every metadata of the item.
Suppose Item is in X, so it has Item[Field1] = XField1, Item[Fied2] = Xfield2.
I use this plugin, I move Item to Y. Now Item must have Item[Field1] = YField1, Item[Fied2] = Yfield2.
And now comes the problems, 'cause there are more than one event handler that works on my item:
- Plugin EH wants to put XField1 in Field1
- My EH wants to put YField1 in Field1
The result? It depends on the order:
- Came first Plugin EH?
Does my EH face the problem of the modified Item => Plugin EH wins (not correct)
No facing of the problem => My EH wins (correct)
And viceversa.
I cannot put my hands on Plugin Code so I'm asking: is there any way to know if an Item is being used by someone?
If in my code I can say: "Ok, so Plugin is running on it, I must wait" I'll get the right result.
I tried with Item.File.CheckOutStatus but always figures as NONE
Does anybody have an idea?
I tried also to trap the exception in my code and this works but when my EH cames first the exception occurs on the "black box Plugin side" so I cannot mess with..