所有二进制文件都以相同的方式处理 - 因此他的图像技术对文档同样有效,只需确保使用具有适当 mime 类型的架构即可.I want to push PDF, Word and Excel files into SDL Tridion 2011 by using core service.I tried below code but get this error:using (ChannelFactory<ISessionAwareCoreService> factory = new ChannelFactory<ISessionAwareCoreService>("wsHttp_2011")){ ISessionAwareCoreService client = factory.CreateChannel(); ComponentData multimediaComponent = (ComponentData)client.GetDefaultData( ItemType.Component, "tcm:19-483-2"); multimediaComponent.Title = "MultimediaFile"; multimediaComponent.ComponentType = ComponentType.Multimedia; multimediaComponent.Schema.IdRef = "tcm:19-2327-8"; using (StreamUploadClient streamClient = new StreamUploadClient()) { FileStream objfilestream = new FileStream(@"\My Documents\My Poc\images.jpg", FileMode.Open, FileAccess.Read); string tempLocation = streamClient.UploadBinaryContent("images.jpg", objfilestream); } BinaryContentData binaryContent = new BinaryContentData(); binaryContent.UploadFromFile = @"C:\Documents and Settings\My Poc\images.jpg"; binaryContent.Filename = "images.jpg"; binaryContent.MultimediaType = new LinkToMultimediaTypeData() { IdRef ="tcm:0-2-65544" }; multimediaComponent.BinaryContent = binaryContent; IdentifiableObjectData savedComponent = client.Save(multimediaComponent, new ReadOptions()); client.CheckIn(savedComponent.Id, null); Response.Write(savedComponent.Id);} 解决方案 Have a read of Ryan's excellent article here http://blog.building-blocks.com/uploading-images-using-the-core-service-in-sdl-tridion-2011All binary files are handled the same way - so his technique for images will be equally as valid for documents, just make sure you use a Schema with the appropriate mime types. 这篇关于如何使用核心服务将外部文件导入 SDL Tridion 2011?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-25 19:50