Tuesday, February 22, 2011

sharepoint foundation + delete item + Cannot complete this action.

I have created some lists & related lists using object model. Im changing my column names also at the time of creating the field with SPRelationshipDeleteBehavior.

when I try to delete the item in parent list, istead of showing the message "This item cannot be deleted because ....." , it threw error like "Cannot complete this action...", when I check log , no luck. (found one related to lock, not sure what it is).

Then after long trial and error methods, I changed my code to two parts.
1. Create lists and related lists
2. for the specific fields set deleterelationshipBehaviour

from then its working. I guess the field name might cause the error, as index is created using old name.

1 comment:

  1. The tip is to NOT set the relationshipBehavior during the template application.

    Just add a feature that do the job after the ApplyWebTemplate in the provisionning file.

    ReplyDelete