Please let me know how to get the list of parent structure groups from the given page id using core service 2013?

I was try to use below code in my workflow automatic activity to get the page detail but it was giving error:

var tridionItems = CoreServiceClient.GetListXml(workitem.Subject.IdRef, new RepositoryItemsFilterData { ItemTypes = new[] { cs.ItemType.StructureGroup } });

Error Message:

Unexpected item type: Page.

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Tridion.ContentManager.CoreService.Client.ISessionAwareCoreService.GetListXml(String id, SubjectRelatedListFilterData filter)
   at Tridion.ContentManager.CoreService.Client.SessionAwareCoreServiceClient.GetListXml(String id, SubjectRelatedListFilterData filter)
   at Workflow.SkipApproval.Execute()
  • Vivek - you should show what you've tried here first so people don't spend all their time re-inventing the wheel. have you looked at the API? did you see/try anything that you thought should work? (post the code as an example - maybe your syntax needs review). Have you searched TREX - this is not the first time this question has been asked. Commented Oct 15, 2015 at 14:07
  • Do you mean a recursive list up to the root Structure Group? Commented Oct 15, 2015 at 15:35

2 Answers 2


You should use OrganizationalItemAncestorsFilterData

The CoreService API reference (which you can download from here) has a good example on how to do this:

OrganizationalItemAncestorsFilterData filter = new OrganizationalItemAncestorsFilterData();
IEnumerable<IdentifiableObjectData> list = client.GetList("tcm:1-2-64", filter);
  • Thanks Nuno your provided solutions works for providing recursive list up to the root Structure Group. Commented Oct 16, 2015 at 5:16

As Nuno suggested you should use OrganizationalItemAncestorsFilterData filter instead of Repository item filters.

If you are looking for path till root structure group do the following-
PageData pageData= (PageData)client.Read(pageTCM, new ReadOptions());
string pageLocation = pageData.LocationInfo.Path.ToString();

Also you can extract Structure Group name from the path if you want.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.