views:

186

answers:

1

Hi

I want sharepoint to "persist" a List of object

I wrote a class SPAlert wich inherit from SPPersistedObject :

public class SMSAlert: SPPersistedObject
{
        [Persisted]
        private DateTime _scheduledTime;

        [Persisted]
        private Guid _listId;
        [Persisted]
        private Guid _siteID;
}

Then I wrote a class wich inherit from SPJobDefinition an add a List of my previous object:

public sealed class MyCustomJob: SPJobDefinition
{


        [Persisted]
        private List<SMSAlert> _SMSAlerts;
}

The problem is :

when I call the Update method of y MyCustomJob:

myCustomJob.Update();

It throw an exception :

message :

An object in the SharePoint administrative framework, depends on other objects which do not exist. Ensure that all of the objects dependencies are created and retry this operation.

stack

at Microsoft.SharePoint.Administration.SPConfigurationDatabase.StoreObject(SPPersistedObject obj, Boolean storeClassIfNecessary, Boolean ensure) at Microsoft.SharePoint.Administration.SPConfigurationDatabase.PutObject(SPPersistedObject obj, Boolean ensure) at Microsoft.SharePoint.Administration.SPPersistedObject.Update() at Microsoft.SharePoint.Administration.SPJobDefinition.Update() at Sigi.Common.AlertBySMS.SmsAlertHandler.ScheduleJob(SPWeb web, SPAlertHandlerParams ahp)

inner exception

An object in the SharePoint administrative framework depends on other objects which do not exist.

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Dependencies1_Objects".

The conflict occurred in database "SharePoint_Config, table "dbo.Objects", column 'Id'. The statement has been terminated.

Can anyone help me with that??

A: 

Did you specify the default constructor for SMSAlert?

zincorp
No, I didn't do itso I added it and I don't have an exception anymorebut when I retreive my "MyCustomJob" the list has the good number of items, but each item is null
Sam