Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StructureGroup Details using the Content Delivery/Broker API

I am trying to get all the structure groups published in a given publication using the PublicationID. I am expecting to get the structure groups with StructureGroupCriteria by passing the Root Structure Group TCM ID but getting page ids (I am expecting SGs).

Now I am trying to loop through the list and get details of each structuregroup. I did not find any API (.net) to get these details and also the API is returning only Pages.

What I have done and working so far using StructureGroupCriteria, returns list of Page IDs instead of SG IDs

  PublicationCriteria pubCriteria = new PublicationCriteria(pubID);
  // Root StructureGroup TCM ID -- tcm:45-3-4
  StructureGroupCriteria sgCriteria = new StructureGroupCriteria("tcm:45-3-4", true); 
  Criteria allSGsInPub = CriteriaFactory.And(pubCriteria, sgCriteria);
  Query allSGs = new Query(allSGsInPub);
  string[] sgInfo = allSGs.ExecuteQuery();
  Response.Write("Total : " + sgInfo.Length);
  foreach (string sgid in sgInfo ) {
    // HOW DO I get the Structure Group Details here
     //TCMURI sgURI = new TCMURI(sgid);
  }

Q # 1 : How to get the all the structuregroups and individual structure group details? (May be something simple, I am not able to find right API).

Q # 2 : How can I get all the structuregroups using ItemTypeCriteria sgCriteria = new ItemTypeCriteria(4); // 4 is SG Item Type .

When I tried this option, the query worked successfully but no results returned. Is this the expected behavior and should we always use StructureGroupCriteria instead of ItemTypeCriteria?

The reason for this approach, I want to avoid using the Root StructureGroup ID which is required with the above code. But at the moment, none of the approaches returning StructureGroup information and I always get Page Information.

Tridion Version: 2011 SP1, .net API.

Note: When I publish I am checking the publish SG info checkbox and published successfully. On Broker DB side, I can see the information on the taxnonomy table as well.

like image 850
Ram G Avatar asked Aug 30 '12 17:08

Ram G


1 Answers

I was playing with Odata service and accidentally I found that I can get all my structure group information from Odata web service.

/cd_webservice/odata.svc/StructureGroups?$filter=PublicationId%20eq%2045

Also, the results are returning child structure groups with a depth parameter.

Just to clarify , using Broker API it is not feasible to get the structure groups (my original question). However, the workaround solution is to use OData Service to get the Structure Groups.

like image 73
Ram G Avatar answered Nov 07 '22 08:11

Ram G