简体   繁体   English

使用 SDL Tridion 2011 SP1 中的核心服务创建模式

[英]Creation of Schema using Core Service in SDL Tridion 2011 SP1

I am creating Schema using Core Service in SDL Tridion 2011 SP1.我正在使用 SDL Tridion 2011 SP1 中的核心服务创建架构。 In the creation of the Schema I have used the custom namespace URI for the Schema.在创建架构时,我为架构使用了自定义命名空间 URI。 Generally when we create a Schema through Tridion CME directly, we will get a namespace URI generated automatically starting with uuid:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX一般我们直接通过Tridion CME创建Schema的时候,会得到一个自动生成的uuid:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have used this code to create a Schema:我使用这段代码创建了一个架构:

Tridion.ContentManager.CoreService.Client.SchemaData schemas = new SchemaData
{
    Title = "coreservicesschema3",
    Description = "coreservicesschema",
    Id = "tcm:0-0-0",
    LocationInfo = new LocationInfo
    {
        OrganizationalItem =
            new LinkToOrganizationalItemData { IdRef = "tcm:7-18-2" }
    },

    RootElementName = "Content",
    NamespaceUri = "customnamespaceuri",
    Xsd = xsd.ToString(SaveOptions.None)
};
schemas = (SchemaData)client.Create(schemas, new ReadOptions());
Response.Write("<BR>" +"new schema id"+ schemas.Id);
Response.Write("<BR>" + "new schema Name" + schemas.Title);
//schema created

Can anyone indicate how to create a Schema with default namespace URI?谁能指出如何使用默认名称空间 URI 创建架构?

Thank you谢谢

The minimal code you need in order to create a Schema with Core Service is the following:使用核心服务创建模式所需的最少代码如下:

using (var client = new SessionAwareCoreServiceClient(netTcpBinding, remoteAddress))
{
    SchemaData schemaData = client.GetDefaultData(ItemType.Schema, folderId) as SchemaData;
    schemaData.Description = "description";
    schemaData = client.Save(schemaData, readOptions) as SchemaData;
    schemaData = client.CheckIn(schemaData.Id, readOptions) as SchemaData;

    Console.WriteLine("Schema: " + schemaData.LocationInfo.WebDavUrl);
}

The Schema will be created with the default namespace.将使用默认命名空间创建架构。 In the case of this example, it will also not contain any fields, but that's not what you were asking for.在本示例中,它也不包含任何字段,但这不是您所要求的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 访问SDL Tridion 2011 SP1上的核心服务时出错 - Error while accessing the core service on SDL Tridion 2011 SP1 如何使用Core Service在SDL Tridion 2011 SP1中创建文件夹结构 - How to create folder structure in SDL Tridion 2011 SP1 using Core Service 使用核心服务在 SDL Tridion 2011 SP1 中创建具有字段约束的模式 - Creating Schemas with field constraints in SDL Tridion 2011 SP1 using Core Service 如何在Tridion 2011 SP1中使用Core Service创建期间向页面添加组件演示文稿 - How to add component presentations to a page during creation using Core Service in Tridion 2011 SP1 SDL Tridion 2011 SP1:安装监视服务 - SDL Tridion 2011 SP1 : Installing monitoring service 在SDL Tridion 2011 SP1中配置Deployer - configuring Deployer in SDL Tridion 2011 SP1 在Tridion 2011 SP1 HR1中模拟核心服务 - Impersonate core service in Tridion 2011 SP1 HR1 在SDL Tridion 2011 SP1中的Tridion设计中的动态下降 - Dynamic drop downs in Tridion designing in schema in SDL Tridion 2011 SP1 在SDL Tridion 2011 SP1的事件处理程序中使用TOM.NET API从重复的嵌入式架构中获取值 - Getting the values from a repeated Embedded Schema using TOM.NET API in an event handler in SDL Tridion 2011 SP1 如何使用XSLT介体在tridion SDL Tridion 2011 SP1中处理XSLT中的链接组件 - How to handle linked components in XSLT in tridion SDL Tridion 2011 SP1 using XSLT mediator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM