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 5 posts 85 karma points
    1 week ago
    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 431 posts 2383 karma points MVP 4x admin c-trib
    1 week ago
    Anders Bjerner
    100

    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