I have used the below code to set Default Multimedia Schema while creating a multimedia Component.
ComponentData multimediaComponent = (ComponentData) client.getDefaultData(ItemType.COMPONENT, "tcm:246-95-2");
LinkToSchemaData linkToSchemaData = new LinkToSchemaData();
linkToSchemaData.setIdRef(objectFactory.createLinkIdRef("tcm:246-243-8"));
multimediaComponent.setSchema(objectFactory.createLinkToSchemaData(linkToSchemaData));
When I try to run the code I have noticed that the Schema is not correctly set. Can anyone suggest me if there is any other way I can set the Schema reference to create a multimedia Component in SDL Tridion or is there anything I need to change in the above code?