0

I have a site with multiple lists which are linked to each other. When I update an item(edit / approve) in one list, the approval status of the corresponding items in the other lists also should be updated accordingly.

I was able to achieve it using an event receiver on ItemUpdated event, and the item approval is reflected fine.

However, when I further edit an item in any list, the item of course goes into pending status, and I am copying this moderation status to the other lists. But in doing so, the approved version in the other lists are lost; whereas the item in the source list still has an approved item.

This is causing an inconsistency for me because I have an approved item in one list, but not in the other lists. Because of this, Viewers see the item in the 'source list', but when they try to check the other lists, they get an error.

How can I resolve this?

1 Answer 1

0

Well, I was able to solve the issue like below:

if (spiCurrentItem != null)
{
    spiCurrentItem ["Title"] = spModifiedItem.Title;
    if (spModifiedItem.ModerationInformation.Status == SPModerationStatusType.Approved)
    {
        spiCurrentItem.ModerationInformation.Status = SPModerationStatusType.Approved;
    }
    spiCurrentItem.Update();
}

The block where I check for the Approved status will set the specific items in the other lists as Approved, if the modifiedItem has the status as Approved.

Otherwise, a simple Update operation is done on the item, which will create a new version, while retaining the Approved version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.