Add related media to WrapperObject, Custom RSSInboundPipe
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");
Anyone?
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