I have an excel sheet which contains the column with External Image URL and i need to create the multimedia component using that URL and add this image component in my normal component, can anyone help on this with sample code.
-
Have you already tried this and come across problems? Or are you asking for more general help about how to get started? You are much more likely to get a good response if you improve your question by adding details of what you have tried and the problems you encountered.– Dominic CroninCommented Jul 2, 2013 at 15:25
Add a comment
|
1 Answer
Here some sample code. I hope this helps.
CoreServiceClient channel = new CoreServiceClient();
ComponentData component = new ComponentData();
component.Id = "tcm:0-0-0";
component.ComponentType = ComponentType.Multimedia;
component.BinaryContent = new BinaryContentData() {
IsExternal = true,
ExternalBinaryUri = "http://static.businessreviewonline.com/user/storefronts/cbr/tridion/tridion.gif",
MultimediaType = new LinkToMultimediaTypeData() { IdRef = "tcm:0-1-65544" }
};
component.LocationInfo = new LocationInfo() {
OrganizationalItem = new LinkToOrganizationalItemData() {
IdRef = "tcm:3-1004-2"
}
};
component.Title = "Test External Image";
component.Schema = new LinkToSchemaData() { IdRef = "tcm:3-8-8" };
channel.Save(component, null);
-
It's safer to use
GetDefaultData
method instead of setting ID and location manually Commented Jul 2, 2013 at 6:17