Skip to main content
added 203 characters in body
Source Link
Daniel Neagu
  • 1.2k
  • 7
  • 11

WARNING: there is not way to get what you are seeking. You can only get the metadata objects but these do not contain connected entities (CustomMeta or RelatedKeywords). If you're interested only in the properties of resulted items then you can use the following approach

When using the Broker Query API and calling the ExecuteEntityQuery method you actually get the metadata objects you're interested in. You just need to cast them to the right type and access their CustomMeta(with no connected entities). Example:

Tridion.ContentDelivery.Meta.IItem[] results = query.ExecuteEntityQuery();
CustomMeta customMeta = null;

for (int i = 0; i < results.Length; i++)
{
    Tridion.ContentDelivery.Meta.IItem itm = results[i];
    if (itm is IComponentMeta)
    {
        IComponentMeta cm = (IComponentMeta)itm;
        customMeta = cm.CustomMeta;
    } 
    else if (itm is IPageMeta)
    {
        IPageMeta pm = (IPageMeta)itm;
        customMeta = pm.CustomMeta;
    } 
    else if (itm is IKeywordMeta)
    {
        IKeywordMeta km = (IKeywordMeta)itm;
        customMeta = km.CustomMeta;
    }
    else if (itm is ITemplateMeta)
    {
        ITemplateMeta tm = (ITemplateMeta)itm;
        customMeta = tm.CustomMeta;
    }
}

Hope this helps.

When using the Broker Query API and calling the ExecuteEntityQuery method you actually get the metadata objects you're interested in. You just need to cast them to the right type and access their CustomMeta. Example:

Tridion.ContentDelivery.Meta.IItem[] results = query.ExecuteEntityQuery();
CustomMeta customMeta = null;

for (int i = 0; i < results.Length; i++)
{
    Tridion.ContentDelivery.Meta.IItem itm = results[i];
    if (itm is IComponentMeta)
    {
        IComponentMeta cm = (IComponentMeta)itm;
        customMeta = cm.CustomMeta;
    } 
    else if (itm is IPageMeta)
    {
        IPageMeta pm = (IPageMeta)itm;
        customMeta = pm.CustomMeta;
    } 
    else if (itm is IKeywordMeta)
    {
        IKeywordMeta km = (IKeywordMeta)itm;
        customMeta = km.CustomMeta;
    }
    else if (itm is ITemplateMeta)
    {
        ITemplateMeta tm = (ITemplateMeta)itm;
        customMeta = tm.CustomMeta;
    }
}

Hope this helps.

WARNING: there is not way to get what you are seeking. You can only get the metadata objects but these do not contain connected entities (CustomMeta or RelatedKeywords). If you're interested only in the properties of resulted items then you can use the following approach

When using the Broker Query API and calling the ExecuteEntityQuery method you get the metadata objects (with no connected entities). Example:

Tridion.ContentDelivery.Meta.IItem[] results = query.ExecuteEntityQuery();
CustomMeta customMeta = null;

for (int i = 0; i < results.Length; i++)
{
    Tridion.ContentDelivery.Meta.IItem itm = results[i];
    if (itm is IComponentMeta)
    {
        IComponentMeta cm = (IComponentMeta)itm;
        customMeta = cm.CustomMeta;
    } 
    else if (itm is IPageMeta)
    {
        IPageMeta pm = (IPageMeta)itm;
        customMeta = pm.CustomMeta;
    } 
    else if (itm is IKeywordMeta)
    {
        IKeywordMeta km = (IKeywordMeta)itm;
        customMeta = km.CustomMeta;
    }
    else if (itm is ITemplateMeta)
    {
        ITemplateMeta tm = (ITemplateMeta)itm;
        customMeta = tm.CustomMeta;
    }
}

Hope this helps.

Source Link
Daniel Neagu
  • 1.2k
  • 7
  • 11

When using the Broker Query API and calling the ExecuteEntityQuery method you actually get the metadata objects you're interested in. You just need to cast them to the right type and access their CustomMeta. Example:

Tridion.ContentDelivery.Meta.IItem[] results = query.ExecuteEntityQuery();
CustomMeta customMeta = null;

for (int i = 0; i < results.Length; i++)
{
    Tridion.ContentDelivery.Meta.IItem itm = results[i];
    if (itm is IComponentMeta)
    {
        IComponentMeta cm = (IComponentMeta)itm;
        customMeta = cm.CustomMeta;
    } 
    else if (itm is IPageMeta)
    {
        IPageMeta pm = (IPageMeta)itm;
        customMeta = pm.CustomMeta;
    } 
    else if (itm is IKeywordMeta)
    {
        IKeywordMeta km = (IKeywordMeta)itm;
        customMeta = km.CustomMeta;
    }
    else if (itm is ITemplateMeta)
    {
        ITemplateMeta tm = (ITemplateMeta)itm;
        customMeta = tm.CustomMeta;
    }
}

Hope this helps.