Как я могу импортировать внешние файлы в SDL Tridion 2011, используя основной сервис?
Я хочу перенести файлы PDF, Word и Excel в SDL Tridion 2011 с помощью основного сервиса.
Я попробовал приведенный ниже код, но получил эту ошибку:
Invalid value for property 'BinaryContent'. Unable to open uploaded file:
<code>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); } </code>