Copied to clipboard

Flag this post as spam?

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


  • Paul 3 posts 73 karma points
    Mar 27, 2023 @ 10:40
    Paul
    0

    MediaService.GetPagedDescendants Filtering

    Hi U Community,

    My question is how to create a IQuery

    IQuery

    IEnumerable

    for example just want to return media items with a specific filename ie iwtspecieslist.xlsx

    Currently migrating multisite from Wordpress to Umbraco and dealing with mapping all the wordpress media urls to umbraco media urls basically writting a script to save loads of time automating as CMSImport tool does import the pages and HTML but not import the media and convert the urls in the html unless extend the package, write a script or manually convert hundreds of document urls :(

    Anyone know how to filter the GetPagedDescendants function cant see anything in the user guide except that is says there is a filter?

    Thanks,

    Paul

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Mar 27, 2023 @ 11:39
  • Paul 3 posts 73 karma points
    Mar 27, 2023 @ 12:12
    Paul
    0

    Hi Huw,

    Thanks for the link its useful info but think that is for Umbraco 7/8? Looking specifically for Umbraco 10 help.

    Cheers,

    Paul

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Mar 27, 2023 @ 13:25
    Huw Reddick
    1

    I think it should still work basically the same in Umbraco 10

    You could also try an examine search https://www.jondjones.com/learn-umbraco-cms/umbraco-9-tutorials/getting-started-with-umbraco-9/how-to-build-a-search-page-in-umbraco-v9/

  • Paul 3 posts 73 karma points
    Mar 28, 2023 @ 17:07
    Paul
    0

    Hi Huw,

    Got Examine Index working fine in Umbraco 10 so thanks for pointing us in that direction - does what I needed to do 8)

    However the ipublishedcontent query did not run in razor view, did not like some of the import references probably would need adjusting.

    Still partly curious about the provided filter parameter on the MediaService.GetPagedDescendents function seems weird its there but can't find any examples of how to actually use it, the other parameters work ok surely there is a way?

    https://apidocs.umbraco.com/v10/csharp/api/Umbraco.Cms.Core.Services.IMediaService.html#UmbracoCmsCoreServicesIMediaServiceGetPagedDescendantsSystemInt32SystemInt64SystemInt32SystemInt64UmbracoCmsCorePersistenceQueryingIQueryUmbracoCmsCoreModelsIMediaUmbracoCmsCoreServicesOrdering

    But all good for now so will move on unless anyone likes solving these things.

    Thanks again,

    Paul

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Mar 29, 2023 @ 08:09
    Huw Reddick
    0

    Hi Paul,

    Still partly curious about the provided filter parameter on the MediaService.GetPagedDescendents function seems weird its there but can't find any examples of how to actually use it, the other parameters work ok surely there is a way?

    I don't think it would work for your use case as IIRC it only works on strongly typed properties of IContent, something like below

    @inject IQuery<IContent> _query;
    @{
        var filter = _query.Where(x => x.Name == "myPropertyName");
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft