+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Add related media to WrapperObject, Custom RSSInboundPipe

Add related media to WrapperObject, Custom RSSInboundPipe

3 posts, 0 answered
  1. Saad
    Saad avatar
    98 posts
    Registered:
    10 Oct 2008
    01 Aug 2014
    Link to this post

    Hi,

    I’m importing news items from external RSS feed (SF site) which has thumbnail URL in it. I have implemented custom RSSInboundPipe and overridden ConvertToWraperObject method. Here I need
    to add image to the WrapperObject which will fill related media field in News module.

    public override WrapperObject ConvertToWraperObject(System.ServiceModel.Syndication.SyndicationItem item)
    {
        WrapperObject obj = new WrapperObject(null);
        obj.MappingSettings = this.PipeSettings.Mappings;
        obj.Language = this.PipeSettings.LanguageIds.FirstOrDefault();
        // Need to do something like this
        // obj.CreateRelation(image, "Thumbnail");
    }

  2. Saad
    Saad avatar
    98 posts
    Registered:
    10 Oct 2008
    02 Aug 2014 in reply to Saad
    Link to this post

    Anyone?

  3. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    09 Dec 2016
    11 Aug 2014
    Link to this post
    Hello Saad,

    As we have discussed in the support thread you had opened, in the ConvertToWraperObject() method you need to add the properties using obj.AddProperty() method. You may refer to the following article for more details on this.

    In addition to this, you will need also to override the ContentOutboundPipe class and to override the SetPropertiesThroughPropertyDescriptor() method where you can set the properties through the property descriptor. You can call the base method and after that you can add your custom logic for setting your custom properties:

    public class ContentOutboundPipeCustom : ContentOutboundPipe
        {
            protected override void SetPropertiesThroughPropertyDescriptor(Telerik.Sitefinity.Model.IContent item, Telerik.Sitefinity.Publishing.WrapperObject wrapperObj)
            {
                base.SetPropertiesThroughPropertyDescriptor(item, wrapperObj);
       
                        // your custom logic goes here
            }
        }


    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
3 posts, 0 answered