Annotation 2.5 API Create Comment

Hi All,

I have been using the Content Manger API for a few releases now, recently tried using the Annotation classes, the code doesn't through any errors, and returns the expected results. But the annotations are not visible in Collective Spaces. I can find, them update them and delete them through the API. What am I missing any guidance would be great.

emoji
  • Here is the code and the properties I am setting on the comment which doesn't appear.

     string xmlMetadata = "<ishfields>" +
                    "<ishfield name='FISHANNOTATIONTYPE' level='annotation'>Editorial</ishfield>" +
                    "<ishfield name='FISHANNOTATIONTEXT' level='annotation'>Oracle 12.2 is supported and Oracle 12.1 is deprecated</ishfield>" +
                    "<ishfield name='FISHANNOTPROPOSEDCHNGTXT' level='annotation'>Replace 'Oracle 12.1' with 'Oracle 12.2'</ishfield>" +
                    "<ishfield name='FISHREVISIONID' level='annotation'>" + revisionId + "</ishfield>" +
                    "<ishfield name='FISHPUBLOGICALID' level='annotation'>" + pubGUID + "</ishfield>" +
                    "<ishfield name='FISHPUBVERSION' level='annotation'>1</ishfield>" +
                    "<ishfield name='FISHANNOTATIONSTATUS' level='annotation' ishvaluetype='element'>VANNOTATIONSTATUSUNSHARED</ishfield>" +
                    "<ishfield name='FISHANNOTATIONCATEGORY' level='annotation'>Comment</ishfield>" +
                    "<ishfield name='FISHANNOTATIONADDRESS' level='annotation' xml:space='preserve'>[{'revisionId':" + revisionId + ",'type':'TEXT_RANGE_SELECTOR','startContainerQuery':'/*[1]/node()[3]/node()[1]/node()[1]/node()[1]','startOffset':75,'endContainerQuery':'/*[1]/node()[3]/node()[1]/node()[1]/node()[1]','endOffset':80}]</ishfield>" +
                    "</ishfields>";
                    userClientAnnotation.Create(xmlMetadata);

    Here is a comment I made through the UI. Which I was able to find using the find method and request the following metadata.

    <?xml version="1.0" encoding="utf-16"?>
    <ishobjects>
    	<ishobject ishref="GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ishtype="ISHAnnotation" ishannotationref="2840765">
    		<ishfields>
    			<ishfield name="FISHANNOTATIONADDRESS" level="annotation" xml:space="preserve">[{"revisionId":"GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","type":"TEXT_RANGE_SELECTOR","startContainerQuery":"/*[1]/node()[3]/node()[1]/node()[1]/node()[1]","startOffset":60,"endContainerQuery":"/*[1]/node()[3]/node()[1]/node()[1]/node()[1]","endOffset":70}]</ishfield>
    			<ishfield name="FISHANNOTATIONCREATOR" level="annotation" xml:space="preserve">ajain</ishfield>
    			<ishfield name="FISHANNOTATIONCATEGORY" level="annotation" xml:space="preserve">Comment</ishfield>
    			<ishfield name="FISHPUBLOGICALID" level="annotation" xml:space="preserve">GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</ishfield>
    			<ishfield name="FISHANNOTATIONTYPE" level="annotation" xml:space="preserve">Editorial</ishfield>
    		</ishfields>
    	</ishobject>
    </ishobjects>

    I can't tell what is different, if anything. Or is there a step after creating it to make it visible?

    emoji
  • Hi Akheil,

    There is logic inside Draft Space and Review Space to promote orphan topics to the top. However, they still have to be tightly linked to a topic-version within this publication-version and language. That is a first thing to check.

    As explained on a different thread, https://community.rws.com/product-groups/tridion/tridion-docs/f/forum/44237/collective-space-api-where-can-i-find-details/143671 , the addressing logic is proprietary and could lead to orphans as well.

    If I was you, I would start from the working annotation you retrieved and change the ishfield values one-by-one until you get what you are looking for.

    Furthermore, I would advise to not use string concatenation (so the plus operator) for building your xml document. You might have issues if your annotation text contains improper xml/xhtml encoded values (think &, <, > and more).

    -Dave

    PS: crosslinking to another of your posts... community.rws.com/.../143677

    emoji