I am learning how to use the Tridion 2011 Core Service API and am trying to create a new folder containing a new Person schema with a single Name field.

When I run the following code I get the error FaultException : Namespace URI must have a value. If I uncomment the personSchemaFields.Namespa... it works fine but I'm pretty sure that this isn't the correct solution as I get errors later on when trying to use the schema (cannot find uuid:[GUID]:Person).

using (var client = new Tridion2011CoreService.CoreServiceClient())
    var newFolder = client.GetDefaultData(ItemType.Folder, "tcm:4-160721-2");
    newFolder.Title = DateTime.Now.Ticks.ToString();
    newFolder = client.Create(newFolder, new ReadOptions());

    var personSchemaDataFields = new List<ItemFieldDefinitionData>();

    var personSchemaFieldName = new SingleLineTextFieldDefinitionData();
    personSchemaFieldName.Name = "Name";
    personSchemaFieldName.Description = "Name";

    var personSchemaFields = new SchemaFieldsData();
    //personSchemaFields.NamespaceUri = "uuid:" + Guid.NewGuid().ToString();
    personSchemaFields.RootElementName = "Person";
    personSchemaFields.Fields = personSchemaDataFields.ToArray();

    var personSchema = (SchemaData)client.GetDefaultData(ItemType.Schema, newFolder.Id);
    personSchema.Title = "Person";
    personSchema.Description = "Person";
    personSchema.RootElementName = "Person";
    personSchema.Xsd = client.ConvertSchemaFieldsToXsd(personSchemaFields).ToString();
    // The next line generates the following error. "FaultException : Namespace URI must have a value."
    personSchema = (SchemaData)client.Create(personSchema, new ReadOptions());

Could anyone help?

1 Answer 1


Exception is correct. You should provide a NamespaceUri for the schema. The exception you get later on is telling you that you need to set Content property of your ComponentData that will match the schema. You can use GetInstanceData method to get default value of the Content XML

  • Should the personSchemaFields object have the same NamespaceUri as the personSchema? Commented Apr 15, 2013 at 11:38
  • Yes, as Content XML should also be in the same namespace Commented Apr 15, 2013 at 11:42
  • So after rearranging the code a little I set the personSchemaFields.NamespaceUri to the same value as personSchema.NamespaceURi. Thanks. Commented Apr 15, 2013 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.