Skip to main content
2 of 4
added 717 characters in body
user
  • 81
  • 4

Error while creating multimedia component using core service 2013

I am able to delete component using core service client, but when i am trying to create and save one, i get below mentioned exception.

client.Open();
BinaryContentData bcd = new BinaryContentData{
    UploadFromFile = fileInfo.Name,
    MultimediaType = new LinkToMultimediaTypeData(),
    Filename = fileInfo.Name,
    IsExternal = false};
ComponentData compData = new ComponentData();
compData.ComponentType = ComponentType.Multimedia;
compData.BinaryContent= bcd;
compData.LocationInfo = new LocationInfo() { OrganizationalItem = new LinkToOrganizationalItemData() {IdRef = folderuri}};  
compData.Title = MakeValidFileName(fileInfo.Name);
compData.Schema = new LinkToSchemaData() {  IdRef = schemauri };
compData.ApprovalStatus = new LinkToApprovalStatusData {IdRef = "tcm:0-0-0" };
compData.Id = "tcm:0-0-0";
client.Save(compData, new ReadOptions());
client.CheckIn(compData.Id, null);
client.Close();

Any focus on the same is appreciated.

Unexpected item type: Schema.

Component: Tridion.ContentManager.CoreService Errorcode: 0 User: NT AUTHORITY\NETWORK SERVICE StackTrace Information Details: at Tridion.ContentManager.ContentManagement.RepositoryLocalObject.AssertValidContainer(IContainer container) at Tridion.ContentManager.ContentManagement.RepositoryLocalObject.AssertValidContainer() at Tridion.ContentManager.ContentManagement.RepositoryLocalObject..ctor(Session session, TcmUri parentId) at Tridion.ContentManager.ContentManagement.Component..ctor(Session session, TcmUri parentId) at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at Tridion.ContentManager.Session.GetNewObject(Type objectType, String containerUri) at Tridion.ContentManager.Session.GetNewObject(IdentifiableObjectData data) at Tridion.ContentManager.CoreService.CoreServiceBase.Save(IdentifiableObjectData deltaData, ReadOptions readBackOptions) at SyncInvokeSave(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at Tridion.ContentManager.CoreService.CoreServiceInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

user
  • 81
  • 4