I'm creating a web service in C# for Tridion 2009. This web service creates a schema in Tridion based on an XML input file. The schema gets created just fine. But I can't seem to change the schema namespace. I would like to do this on the moment that I create or update the schema.
From:
<xsd:schema targetNamespace="uuid:C5F06CAA-7C03-40CD-A857-351098D7DD99"
To:
<xsd:schema targetNamespace="http://namespace.mynamespace.nl/content/generiek/1.0"
I'm creating the schema as follows:
schema = (Schema)tdse.GetNewObject(Tridion.ContentManager.Interop.TDSDefines.ItemType.ItemTypeSchema, folderID, publicationID);
schema.Title = CreateSlugTitle(schema_title_prefix + portletProviderID);
schema.Description = portletProviderID;
CreateFragmentSchemaFields(schema, tdse, fieldName, fieldType, fieldMandatory, fieldLable);
protected void CreateFragmentSchemaFields(Schema schema, Tridion.ContentManager.Interop.TDS.TDSE tdse, string fieldName, string fieldType, Boolean fieldMandatory, string fieldLable)
{
var schemaField = schema.Fields;
switch (fieldType)
{
case "text":
fieldName = "fragment_text." + CreateSlugTitle(fieldName);
schema.Fields.AddNew(fieldName);
schemaField[fieldName].MaxOccurs = 1;
schemaField[fieldName].FieldType = EnumTridionWebSchemaFieldType.FieldTypeFormatText;
schemaField[fieldName].Description = fieldLable;
schemaField[fieldName].FilterXSLT = "";
schemaField[fieldName].Size = 5;
if (fieldMandatory)
{
schemaField[fieldName].MinOccurs = 1;
}
else
{
schemaField[fieldName].MinOccurs = 0;
}
break;
case "link":
embeddedSchema = (Schema)tdse.GetObject(embeddedLinkSchemaID, EnumOpenMode.OpenModeView, null, XMLReadFilter.XMLReadAll);
fieldName = "fragment_link." + CreateSlugTitle(fieldName);
schema.Fields.AddNew(fieldName);
schemaField[fieldName].Description = fieldLable;
schemaField[fieldName].FieldType = EnumTridionWebSchemaFieldType.FieldTypeEmbed;
schemaField[fieldName].EmbeddedSchema = embeddedSchema;
if (fieldMandatory)
{
schemaField[fieldName].MinOccurs = 1;
}
else
{
schemaField[fieldName].MinOccurs = 0;
}
break;
}
}