I have created a custom folder type with an id property. The id property is automatically set by an OnCreateNodePolicy behaviour. Therefore each time an instance of this folder type is created it gets a unique id. If a folder is copied then the target also gets a new id assigned. If the folder is moved then the target will not get a new id. All this works with the OnCreateNodePolicy. So far so good. But now someone accidentially deleted such a folder and restored it from the bin. After restoring the folder had a new id How can I prevent the assigment of a new id if the folder is restored from the recycle bin but at the same time make sure that a new id is assigned if the folder is copied?
Perhaps you could check your custom ID property, and if it is already present perform a search and re-use the existing ID if you get no results returned from the search.