Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Getting error when using GetResult on content

Vote:
 

I am having problem with getting this error when using GetResult():

Error setting value to 'Category' on 'CUSTOMER.Web.Models.Pages.PAGETYPENAME'

It works with GetContentResult.

Anyone know why this happens?

#116823
Feb 05, 2015 13:16
Vote:
 

You should always use GetContentResult when fetching EPiServer-content. From the documentation:

In fact, de-serializing PageData objects from the index will not even work out-of-the-box. Instead, by only retrieving a reference to matching objects and them fetching them from for instance EPiServer DataFactory, we can be confident that they hold the very latest data from the database and we will also be able to update or delete them should we want to. The integration contains two extension methods that handles this process for us, GetContentResult and GetFilesResult.

Is there a reason why you can't use GetContentResult?

Edit: Corrected doc. url

#116827
Edited, Feb 05, 2015 13:38
Vote:
 

Per, I know that, I went from a custom object to having it as a content object so the old code was using getresult and that was when I saw the message. I changed to use ContentResult and all works fine, but I still wan't to know why I get this error and now I know :) Thanks!

#116845
Feb 05, 2015 16:47
Vote:
 

Oh, I see. Great! :-)

#116854
Feb 06, 2015 7:06
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.