3

We have a Business requirement where they want to Attach some Images in some keywords using keyword metadata schema.

i am able to fetch Metadata Information, but it seems it is not working for the keywords which has image tcm added in metadata .

here is the keyword snapshot :

enter image description here

i am using below code to fetch the metdata :

    if (keywordMeta != null)
                    {
                        List<string> notifications = new List<string>();
                        IDictionary metaNameDictionary = keywordMeta.NameValues;
                        IEnumerator metaNameEnumerator = metaNameDictionary.GetEnumerator();
                        if (metaNameEnumerator != null)
                        {
                            while (metaNameEnumerator.MoveNext())
                            {
                                DictionaryEntry de = (DictionaryEntry)metaNameEnumerator.Current;
                                NameValuePair currentMeta = (NameValuePair)de.Value;
                                if (currentMeta != null)
                                {
                                    using (StreamWriter w = File.AppendText(@"C:\Temp\log.txt"))
                                    {


                                    switch (currentMeta.Name.ToLower())
                                    {
                                        case "title":
                                            syllabusMeta.Title = currentMeta.Value.ToString();
                                            break;

                                        case "sub_title":
                                            syllabusMeta.Sub_Title = currentMeta.Value.ToString();
                                            break;

                                        case "description":
                                             Log($"description is {currentMeta.Value.ToString()}", w);
                                            syllabusMeta.Description = WebUtility.HtmlEncode(currentMeta.Value.ToString());
                                            break;
}
    }

But i do not get tcm id in src in logs :

Log Entry : 11:57:07 18 July 2019
  :
  :description is <p>Sample Description testing</p>
<img></img>

if i use a image path in src then it works fine , i get the full image src tags from metadata. so src with tcm does not comes but src with some string comes in metadata. So below is valid and works

enter image description here

is they any way to fetch tcm id's which are configured in metadata?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.