5

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 Cronin Jul 2 '13 at 15:25
7

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 – Andrey Marchuk Jul 2 '13 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.