Getting all FormContainerBlock blocks from the content repository is throwing this error: Property string too long, max {1} chars

Vote:
 

I'm trying to get all the forms from the content repository and am trying this:

var formContainerType = _contentTypeRepository.Load(typeof(FormContainerBlock));
var formContainerReferences = _contentRepository.GetDescendents(ContentReference.RootPage);
var allForms = _contentRepository.GetItems(formContainerReferences, LanguageSelector.AutoDetect(true)).Where(content => content.ContentTypeID == formContainerType.ID);

But I get this error on `GetItems`:

EPiServer.Core.InvalidPropertyValueException: 'Property string too long, max {1} chars'

Am I pulling this right? Seems odd to be getting this error on items that are already created.

#303756
Jun 19, 2023 15:47
Vote:
 

Hi,

You probably should use the IFormRepository and IFormDataRepository interfaces to retrieve forms.

Then you should be able to do:

var forms = _formRepository.Service.GetFormsInfo(null); 
foreach (var form in forms){
 ...
}

Paul

#303801
Jun 20, 2023 9:28
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.