Here’s the background:
There is a docset that contains documents. These documents have unique securities.
When I change a certain property of the docset, in the event handler I want the documents to update their security accordingly. (Most likely by either kicking off another event handler that changes the document security, or directly calling a function that updates the security.)
Question: Security aside, is it possible, and if so how, to access documents within a docset? i.e. from the docset as SPItemEventProperties.
Example:
I would expect it to look something like…
public override void ItemUpdated(SPItemEventProperties properties)
{
//... other stuff
string oldDiv = Convert.ToString(properties.BeforeProperties["Division"]);
string newDiv = Convert.ToString(properties.AfterProperties["Division"]);
if (oldDiv != newDiv)
{
try
{
// update each document (that has security "My Division Team")
foreach (documentx in properties.listitem.????) {
if (documentx.securitylevel == "my division team") {
updatesecurity(documentx); // this is my own custom function
}}}
Please correct me if the question doesn’t make sense.
It is possible. As Steve B points out above it requires treating the docset as a folder. The magic line of code in this case is: