Tridion 无法使用Coreservice创建组件

Tridion 无法使用Coreservice创建组件,tridion,tridion-2011,Tridion,Tridion 2011,我正在尝试使用以下代码使用coreservice创建组件,当我执行exe时,收到错误“找不到uuid:”64c7e56a-161d-4698-a76b-7fd96227948d:Content“ 我已经打开了链接到这个组件的模式,我在那里也看到了这个UUID 到目前为止,我只是试图通过提供硬记录的文件夹、模式和标题来创建一个组件 若你们能指导我如何在组件中添加字段值,那个就太好了。(例如,假设我的模式中有一个字段“Text”链接到此组件,我想使用相同的程序在组件的此字段中添加“this is t

我正在尝试使用以下代码使用coreservice创建组件,当我执行exe时,收到错误“找不到uuid:”64c7e56a-161d-4698-a76b-7fd96227948d:Content“

我已经打开了链接到这个组件的模式,我在那里也看到了这个UUID

到目前为止,我只是试图通过提供硬记录的文件夹、模式和标题来创建一个组件

若你们能指导我如何在组件中添加字段值,那个就太好了。(例如,假设我的模式中有一个字段“Text”链接到此组件,我想使用相同的程序在组件的此字段中添加“this is the Text”)

你能帮我解决这个问题吗

使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用dctmtosdlmigation.sdlcoservicereference;
命名空间dctmtosdl迁移
{
班级计划
{
静态dctmtosdlmigation.sdlcoservicereference.SessionAwareCoreService2010Client=new SessionAwareCoreService2010Client();
静态ReadOptions ReadOptions=新的ReadOptions();
静态void CreateComponent()
{
尝试
{
字符串TargetFolderTcmId=“tcm:148-1263-2”;
字符串LinkSchemaTcmId=“tcm:148-11460-8”;
ComponentData CurrentMigrationComponent=client.GetDefaultData(ItemType.Component,TargetFolderTcmId)作为ComponentData;
LinkToSchemaData SchemaToUse=新的LinkToSchemaData();
SchemaToUse.IdRef=LinkSchemaTcmId.ToString();
CurrentMigrationComponent.Schema=SchemaToUse;
CurrentMigrationComponent.Title=“测试组件”;
创建(CurrentMigrationComponent,readoptions);
Console.WriteLine(CurrentMigrationComponent.Id);
Console.ReadLine();
}
捕获(例外e)
{
控制台写入线(e.Message);
Console.ReadLine();
}
}
静态void Main(字符串[]参数)
{
CreateComponent();
}
}
}

您需要设置组件的内容属性


XmlDocument doc=新的XmlDocument()

doc.LoadXml(string.Format(@“Hello”,SchemaToUse.NamespaceUri));
CurrentMigrationComponent.Content=doc.DocumentElement;

您好,您介意解释一下您的回答吗?{0}这意味着什么?如果我有更多的字段,这是否应该增加?我是否需要删除我的任何代码行?在我的程序中保留代码行的位置?架构的命名空间uri。您必须读取架构。您将通过schema.SchemaspaceUri属性获得命名空间uri。您不能创建没有内容的组件,这是基本的组件是您指定的字段+模式中指定的内容。
doc.LoadXml(string.Format(@"<Content xmlns='{0}'><Test>Hello</Test></Content>",     SchemaToUse.NamespaceUri));

CurrentMigrationComponent.Content = doc.DocumentElement;