Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sebastian Budka 12 posts 93 karma points
    May 22, 2020 @ 08:52
    Sebastian Budka
    0

    Get IContent by ISearchResult

    We used to get IContent by the SearchResult.Id like so:

    private void GetContent(SearchResult searchResult)
    {
        var content = _contentService.GetById(searchResult.Id);
        // do stuff with content
    }
    

    Right now using ISearchResult we are not able to get content, as its Id property was changed to string in new version of Examine.

    Do you know how can I achieve this in Umbraco 8?

  • Anders Bjerner 487 posts 2990 karma points MVP 8x admin c-trib
    May 23, 2020 @ 19:25
    Anders Bjerner
    101

    Hi Sebastian,

    The Id property still holds the numeric ID, but now as a string. So _contentService.GetById(int.Parse(searchResult.Id)) should do do the trick ;)

Please Sign in or register to post replies

Write your reply to:

Draft