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.
Event Viewer shows following logs :
Unexpected item type: Schema.
Component: Tridion.ContentManager.CoreService Errorcode: 0 User: NT AUTHORITY\NETWORK SERVICE StackTrace Information Details:
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)
while Code level debugging gives following exception message and stack trace :
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Tridion.ContentManager.CoreService.Client.ISessionAwareCoreService.Save(IdentifiableObjectData deltaData, ReadOptions readBackOptions)