torsdag 11 augusti 2011

Deleting a SPPersistedObject

A really annnoying behaviour concerning persisted objects: even though the object fails to serialize when you update it the first time to save it (maybe you've forgot to create a default constructor or you use types that are not serializable), it will still be saved even though you get an error. The catastrophy happens when you try to get it back ( e.g. SPFarm.Local.GetObject(Id) ) to delete it. You get an error saying that the object cannot be deserialized and thus you can't delete the object.

Another strange this is that when I try to add or get another object that serializes / deserializes correctly, sharepoint, it seems, tries to deserialize the failing object aswell and so I can't use any objects.

I tried the "The undocumented deleteconfigurationobject parameter" but that gave the same error. I had to use "The (totally unsupported) solution" mentioned here and delete it manually from the database :(

Inga kommentarer:

Skicka en kommentar