Friday, March 2, 2012

How to Get the MetaData of ContentBlock in Ektro CMS

Here i will show how to get the meta data of content in ektron CMS.We have some API features to get the meta data of content block.In this One is Content API and other one is meta data API.The another way i:e Taxonomy is used to get the content block details.But it to difficult comparing with existing API.Here the content id is getting from Page host then pass to content Id variable.Then get the meta data of content using following code

codebehind:

Ektron.Cms.Controls.ContentBlock cb = new Ektron.Cms.Controls.ContentBlock();
cb.DefaultContentID = contentid;
Ektron.Cms.API.Content.Content CAPi = new Ektron.Cms.API.Content.Content();
Ektron.Cms.ContentData CData = new Ektron.Cms.ContentData();
CData = CAPi.GetContent(contentid, Ektron.Cms.
ContentAPI.ContentResultType.Published);
Label lbf = new Label();
lbf.Text = "

"+CData.Title.ToString()+"

"; string image=CData.Image.ToString();
// using meta data API
Ektron.Cms.API.Metadata mapi = new Ektron.Cms.API.Metadata();
Ektron.Cms.CustomAttributeList cList = new Ektron.Cms.CustomAttributeList();
cList = mapi.GetContentMetadataList(contentid); 
//Content ID
Response.Write(cList.AttributeList.Length.ToString());
Response.Write(cList.GetItemByName("Image"));

No comments:

Bel