If you would like to discuss anything, please contact me via email: Howard.Bayliss@sequence.co.uk

Friday, September 9, 2011

SharePoint 0x810200c6 List Validation Failed

We use custom code to create a new Publishing Page:

SPWeb currentWeb = SPContext.Current.Web;

PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(currentWeb);

PublishingPage page = publishingWeb.GetPublishingPages().Add(newPageName, newPageLayout);

This was failing with the error:

<nativehr>0x810200c6</nativehr><nativestack></nativestack>List data validation failed.

The error was caused because the Pages library had validation applied to it, which validated two date fields. The formula for the validation was:

=[Start Date and Time]<[End Date and Time]

When the page was created in code, the validation was fired, which failed because the two date fields are initially empty.

The solution to the problem was to change the validation formula to handle the initial values e.g.

=[Start Date and Time]<=[End Date and Time]

No comments:

Post a Comment