I am trying to get all Page metadata fields using Core Service, but PageData.Metadata returns only fields having values defined in Page metadata in Tridion. I would like to retrieve all fields even if the values are not entered.

XElement xmlData;
XDocument doc;

doc = XDocument.Parse(pageData.Metadata);
xmlData = doc.Root;
var ns = xmlData.GetDefaultNamespace();

1 Answer 1


That is not possible directly. Components and other "content" data, like the Page metadata from your example, are saved as raw XML into the Content Manager database. The XMLs don't contain empty nodes for elements without values and because the Core Service just exposes the whole "section" of the XML to you, you won't have the empty nodes there either.

What you could do is to take a look at the SchemaFieldsData class and its property MetadataFields, which will give you a list of the schema's meta fields in the form of ItemFieldDefinitionData. That class in turn has the Name property which corresponds to xml field name.

You get the SchemaFieldsData object via the ReadSchemaFields() method which takes the id of the metadata Schema ( which you can get by using PageData.MetadataSchema.IdRef)

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.