Copied to clipboard

Flag this post as spam?

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


  • Edgar Rasquin 326 posts 925 karma points
    Jun 10, 2022 @ 14:24
    Edgar Rasquin
    0

    Webservice - getByUdi

    Hello all,

    I have a question about a web service. In my method I want to create a media item if it does not exist yet. In umbraco v7 I have always used the following code.

    var existingFile = mediaService.GetById(mediaId);
    

    Where mediaId was an int.

    Now I am working in umbraco v8 and get the input paramter as Udi. Unfortunately there is no function GetByUdi

    How can I get the id from the Udi so I can check if the media item already exists? Or is there a way to check with the Udi if the file already exists?

    Thanks

  • Edgar Rasquin 326 posts 925 karma points
    Jun 13, 2022 @ 12:06
    Edgar Rasquin
    100

    To anyone who might be interested. The GetById actually takes as Parameter the Guid.

    The following post helped me out: https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/89070-udi-and-contentservice-getvalue#comment-281576

Please Sign in or register to post replies

Write your reply to:

Draft