This project is read-only.

Issues with saving


Hi, firstly thanks for your code - it has been very helpful in my project.
That said I seem to be having problems when it comes to converting the values back to the listItem.

This is the current method I'm using.
var lstItem = list[0];

var validation = new CESAValidation();

validation = list.ProjectToEntity<CESAValidation>();

validation.ValidationCompleted = DateTime.Now;
validation.ValidationExpires = null;
 validation.ValidationStatus = ValidationStatusEnum.Declined.ToString();
But it has issues, I'm not sure why.
I added some extra code to cope with the date mapping. Around the MapperExtensions.cs in BuildListItem
if (x is DateTime)


                                //this works if for the document
                                listItem[property.NameFieldSharepoint] = ((DateTime)x).ToString("yyyy-MM-ddTHH:mm:ssZ");
But I still have issues.
Not sure why, I've tried debugging and going back and forth but with no luck.
It could be because I've got User items in my list - but I've been removing that from the mapper and tried but to no avail.

Thanks for your help.


rhousham wrote Jan 11, 2017 at 10:20 AM

Ah seems to be something in my config.
I simplified it - just changing one field and it's ok.

I'll continue adding fields until it breaks.
Should be able to find the fault.

rhousham wrote Jan 11, 2017 at 10:46 AM

Yeah added
if(property.NameFieldSharepoint == "ID")
                        //don't update the ID, even if it's the same
                        //sharepoint really, really doesn't like it!
to the BuildListItem and it's happy again!