Question

I have an event receiver that runs when metadata on a folder (docset) is updated. In the same event receiver, I want to run kick off an event receiver for each document in the folder. What I want to know is: is it possible to call an event receiver using a different SPitemEventProperties than the one given.

e.g.

public override void ItemUpdated (SPItemEventProperties properties) {
// when properties is/contains a folder:
// on each document in the folder
// run ItemUpdated where properties is a/contains a document
}

Is it possible to do this? If so, any ideas?

Was it helpful?

Solution

Short answers: no. There is possibly a really hacky way to do it but no obvious solution.

For my particular situation, it was easier to setup the environment so the document inherits the changing piece of metadata so it's event receiver fires when this column changes. Hope it helps someone else in the future, or for my own records if no one else reads this.

OTHER TIPS

You can call SPListItem.Update() on each document folder ItemUpdatedER. This run document EventReceiver.

public override void ItemUpdated (SPItemEventProperties properties) {
    query all sub items/documents
    on each document change your data:
    item["customField"] = "update value";
    item.Update() //call recursively ItemUpdating/ItemUpdate
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top