Collective Space API examples or samples

Hi there,

New to Annotations and Collective Spaces, looking to automate annotations. I am having a hard time getting started on creating annotations, I get a "Security error" when invoking the Annotaiton 2.5 methods. Looking for a sample or example if anyone has used these API.

This is what I have so far

            Boolean success = false;
            // using (Trisoft.InfoShare.API25.DocumentObj userClientObj = new Trisoft.InfoShare.API25.DocumentObj())
            
            Trisoft.InfoShare.API25.Annotation userClientAnnotation = new Trisoft.InfoShare.API25.Annotation();
            revisionId = "GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
            pubGUID = "GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
            string xmlMetadata = "<ishfields>" +
                "<ishfield name='FISHANNOTATIONTYPE' level='annotation'>General</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'>VANNOTATIONSTATUSSHARED</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]','startOffset':0,'endContainerQuery':'/*[1]/node()[3]/node()[1]/node()[1]','endOffset':34}]</ishfield>" +
                "</ishfields>";
            try
            {
                userClientAnnotation.Create(xmlMetadata);
            }catch(Exception e)
            {
                Console.WriteLine(e.Message+e.StackTrace);
            }

The error I get when run:-

Security error.   at Trisoft.InfoShare.Core.Identity.Services.Base.BaseUserContextPrincipalService.GuardIdentity()
   at Trisoft.InfoShare.Core.Identity.Services.Base.BaseUserContextPrincipalService.get_UserContext()
   at Trisoft.InfoShare.Core.Identity.Services.UserContextAuthorizationService.RefreshCache()
   at Trisoft.InfoShare.API25.Annotation.Create(String xmlMetadata)

We are on TD14 SP3, hope someone can point me in the right direction.

Thanks in advance

emoji
Parents Reply Children
No Data