4.1 Create a New Navigation Hierarchy

In this example, a new navigation hierarchy is created. The navigation hierarchy will be created using the menu names, link types, and URLs specified in the following table.

Menu name

Link type

URL

Home

Simple

http://www.contoso.com

   Products

Friendly URL

/sites/site1/products

      Bicycles

Friendly URL

/sites/site1/products/bicycles

      Skis

Friendly URL

/sites/site1/products/skis

Events

Friendly URL

/sites/site1/events

   Summer Expo

Friendly URL

/sites/site1/events/summer-expo

The operation is summarized in the following sequence of requests and responses.

The protocol client creates a TaxonomySession ([MS-EMMCSOM] section 3.1.5.15) object, and queries for all TermStore ([MS-EMMCSOM] section 3.1.5.23) objects.

Request:

 <Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
   <Actions>
     <ObjectPath Id="2" ObjectPathId="1" />
     <ObjectPath Id="4" ObjectPathId="3" />
     <ObjectPath Id="6" ObjectPathId="5" />
     <Query Id="7" ObjectPathId="5">
       <Query SelectAllProperties="false">
         <Properties>
           <Property Name="TermStores" SelectAll="true">
             <Query SelectAllProperties="false">
               <Properties />
             </Query>
           </Property>
         </Properties>
       </Query>
     </Query>
   </Actions>
   <ObjectPaths>
     <StaticProperty Id="1" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />
     <Property Id="3" ParentId="1" Name="Site" />
     <Constructor Id="5" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}">
       <Parameters>
         <Parameter ObjectPathId="3" />
         <Parameter Type="Boolean">true</Parameter>
       </Parameters>
     </Constructor>
   </ObjectPaths>
 </Request>

The protocol server returns a collection of TermStore objects. In this case, there is only one.

Response:

 [
 {
 "SchemaVersion":"15.0.0.0","LibraryVersion":"15.0.3410.1000","ErrorInfo":null
 },2,{
 "IsNull":false
 },4,{
 "IsNull":false
 },6,{
 "IsNull":false
 },7,{
 "_ObjectType_":"SP.Taxonomy.TaxonomySession","_ObjectIdentity_":"fec14c62-7c3b-481b-851b-c80d7802b224:ta:","TermStores":{
 "_ObjectType_":"SP.Taxonomy.TermStoreCollection","_Child_Items_":[
 {
 "_ObjectType_":"SP.Taxonomy.TermStore","_ObjectIdentity_":"fec14c62-7c3b-481b-851b-c80d7802b224:st:TKE6KUAnlkq7BYswGJADmQ==","ContentTypePublishingHub":null,"DefaultLanguage":1033,"Id":"\/Guid(293aa14c-2740-4a96-bb05-8b3018900399)\/","IsOnline":true,"Languages":[
 1033
 ],"Name":"Managed Metadata Service Application Proxy","WorkingLanguage":1033
 }
 ]
 }
 }
 ]
  

The protocol client calls the TermStore.GetSiteCollectionGroup (as specified in [MS-EMMCSOM] section 3.1.5.23.2.2.8) method to retrieve a TermGroup object. Then it calls the TermGroup.CreateTermSet (as specified in [MS-EMMCSOM] section 3.1.5.18.2.2.1) method to create a new navigation term set. The name of the new term set is "Navigation Demo".

Request:

 <Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
   <Actions>
     <ObjectPath Id="30" ObjectPathId="29" />
     <ObjectIdentityQuery Id="31" ObjectPathId="29" />
     <ObjectPath Id="33" ObjectPathId="32" />
     <ObjectIdentityQuery Id="34" ObjectPathId="32" />
     <Method Name="CommitAll" Id="35" ObjectPathId="11" />
   </Actions>
   <ObjectPaths>
     <Method Id="29" ParentId="11" Name="GetSiteCollectionGroup">
       <Parameters>
         <Parameter ObjectPathId="3" />
         <Parameter Type="Boolean">true</Parameter>
       </Parameters>
     </Method>
     <Method Id="32" ParentId="29" Name="CreateTermSet">
       <Parameters>
         <Parameter Type="String">Navigation Demo</Parameter>
         <Parameter Type="Guid">{e742cc24-69e6-428e-81ca-156119ff0979}</Parameter>
         <Parameter Type="Int32">1033</Parameter>
       </Parameters>
     </Method>
     <Identity Id="11" Name="fec14c62-7c3b-481b-851b-c80d7802b224:st:TKE6KUAnlkq7BYswGJADmQ==" />
     <Property Id="3" ParentId="1" Name="Site" />
     <StaticProperty Id="1" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />
   </ObjectPaths>
 </Request>

The protocol server returns the identifier of the new TermSet object.

Response:

 [
 {
 "SchemaVersion":"15.0.0.0","LibraryVersion":"15.0.3410.1000","ErrorInfo":null
 },30,{
 "IsNull":false
 },31,{
 "_ObjectIdentity_":"fec14c62-7c3b-481b-851b-c80d7802b224:gr:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMc="
 },33,{
 "IsNull":false
 },34,{
 "_ObjectIdentity_":"fec14c62-7c3b-481b-851b-c80d7802b224:se:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ\u002fwl5"
 }
 ]

The protocol client calls the NavigationTermSet.GetAsResolvedByWeb (section 3.1.5.7.2.2.8) method to create a new NavigationTermSet (section 3.1.5.7) object using the global navigation taxonomy provider. It sets the IsNavigationTermSet (section 3.1.5.7.1.1.2) property to true, and the TargetUrlForChildTerms.Value (section 3.1.5.7.1.2.2) property to "~site/Pages/Topics/Topic.aspx".

Request:

 <Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
   <Actions>
     <ObjectPath Id="39" ObjectPathId="38" />
     <ObjectPath Id="41" ObjectPathId="40" />
     <ObjectIdentityQuery Id="42" ObjectPathId="40" />
     <SetProperty Id="43" ObjectPathId="40" Name="IsNavigationTermSet">
       <Parameter Type="Boolean">true</Parameter>
     </SetProperty>
     <ObjectPath Id="45" ObjectPathId="44" />
     <SetProperty Id="46" ObjectPathId="44" Name="Value">
       <Parameter Type="String">~site/Pages/Topics/Topic.aspx</Parameter>
     </SetProperty>
     <Method Name="CommitAll" Id="47" ObjectPathId="11" />
   </Actions>
   <ObjectPaths>
     <Property Id="38" ParentId="1" Name="Web" />
     <StaticMethod Id="40" Name="GetAsResolvedByWeb" TypeId="{5ed5ae4c-8e92-4e56-af6e-d349611614d8}">
       <Parameters>
         <Parameter ObjectPathId="32" />
         <Parameter ObjectPathId="38" />
         <Parameter Type="String">GlobalNavigationTaxonomyProvider</Parameter>
       </Parameters>
     </StaticMethod>
     <Property Id="44" ParentId="40" Name="TargetUrlForChildTerms" />
     <Identity Id="11" Name="fec14c62-7c3b-481b-851b-c80d7802b224:st:TKE6KUAnlkq7BYswGJADmQ==" />
     <StaticProperty Id="1" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />
     <Identity Id="32" Name="fec14c62-7c3b-481b-851b-c80d7802b224:se:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ/wl5" />
   </ObjectPaths>
 </Request>

The protocol server returns the identifier of the new NavigationTermSet object.

Response:

 [
 {
 "SchemaVersion":"15.0.0.0","LibraryVersion":"15.0.3410.1000","ErrorInfo":null
 },39,{
 "IsNull":false
 },41,{
 "IsNull":false
 },42,{
 "_ObjectIdentity_":"c9a9c738-3bb7-475b-83f4-7edbc963099e:nt:se:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ\u002fwl5;\u002fsites\u002fpub1||`1|0"
 },45,{
 "IsNull":false
 }
 ]

Finally the protocol client creates the navigation hierarchy of NavigationTerm (section 3.1.5.5) objects. It calls the NavigationTermSet.CreateTerm (section 3.1.5.7.2.2.1) and NavigationTerm.CreateTerm (section 3.1.5.5.2.2.1) methods on objects to construct each node in the hierarchy. For the "Home" menu item, it sets the SimpleLinkUrl (section 3.1.5.5.1.1.8) property to "http://www.contoso.com". All other NavigationTerm objects are configured to use a friendly URL.

Request:

 <Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
   <Actions>
     <ObjectPath Id="50" ObjectPathId="49" />
     <ObjectIdentityQuery Id="51" ObjectPathId="49" />
     <SetProperty Id="52" ObjectPathId="49" Name="SimpleLinkUrl">
       <Parameter Type="String">http://www.contoso.com/</Parameter>
     </SetProperty>
     <ObjectPath Id="54" ObjectPathId="53" />
     <ObjectIdentityQuery Id="55" ObjectPathId="53" />
     <ObjectPath Id="57" ObjectPathId="56" />
     <ObjectIdentityQuery Id="58" ObjectPathId="56" />
     <ObjectPath Id="60" ObjectPathId="59" />
     <ObjectIdentityQuery Id="61" ObjectPathId="59" />
     <ObjectPath Id="63" ObjectPathId="62" />
     <ObjectIdentityQuery Id="64" ObjectPathId="62" />
     <ObjectPath Id="66" ObjectPathId="65" />
     <ObjectIdentityQuery Id="67" ObjectPathId="65" />
     <Method Name="CommitAll" Id="68" ObjectPathId="11" />
   </Actions>
   <ObjectPaths>
     <Method Id="49" ParentId="40" Name="CreateTerm">
       <Parameters>
         <Parameter Type="String">Home</Parameter>
         <Parameter Type="Enum">2</Parameter>
         <Parameter Type="Guid">{33e12d60-2332-4612-917d-48b2896699b9}</Parameter>
       </Parameters>
     </Method>
     <Method Id="53" ParentId="40" Name="CreateTerm">
       <Parameters>
         <Parameter Type="String">Products</Parameter>
         <Parameter Type="Enum">1</Parameter>
         <Parameter Type="Guid">{87faa433-4e3e-4500-aa5b-e04330b12acd}</Parameter>
       </Parameters>
     </Method>
     <Method Id="56" ParentId="53" Name="CreateTerm">
       <Parameters>
         <Parameter Type="String">Bicycles</Parameter>
         <Parameter Type="Enum">1</Parameter>
         <Parameter Type="Guid">{da5e60a5-d339-44c9-8c8f-a7e6eaa2d587}</Parameter>
       </Parameters>
     </Method>
     <Method Id="59" ParentId="53" Name="CreateTerm">
       <Parameters>
         <Parameter Type="String">Skis</Parameter>
         <Parameter Type="Enum">1</Parameter>
         <Parameter Type="Guid">{d30a51bf-a71b-45b5-ae1e-945327df6f49}</Parameter>
       </Parameters>
     </Method>
     <Method Id="62" ParentId="40" Name="CreateTerm">
       <Parameters>
         <Parameter Type="String">Events</Parameter>
         <Parameter Type="Enum">1</Parameter>
         <Parameter Type="Guid">{7408f146-623e-4384-a53a-ec0a8c39a17a}</Parameter>
       </Parameters>
     </Method>
     <Method Id="65" ParentId="62" Name="CreateTerm">
       <Parameters>
         <Parameter Type="String">Summer Expo</Parameter>
         <Parameter Type="Enum">1</Parameter>
         <Parameter Type="Guid">{2236b9e8-5d6e-42fc-bf47-49a02af1ca4e}</Parameter>
       </Parameters>
     </Method>
     <Identity Id="11" Name="fec14c62-7c3b-481b-851b-c80d7802b224:st:TKE6KUAnlkq7BYswGJADmQ==" />
     <Identity Id="40" Name="c9a9c738-3bb7-475b-83f4-7edbc963099e:nt:se:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ/wl5;/sites/pub1||`1|0" />
   </ObjectPaths>
 </Request>

The protocol server returns the IDs of the new NavigationTerm objects.

Response:

 [
 {
 "SchemaVersion":"15.0.0.0","LibraryVersion":"15.0.3410.1000","ErrorInfo":null
 },50,{
 "IsNull":false
 },51,{
 "_ObjectIdentity_":"c9a9c738-3bb7-475b-83f4-7edbc963099e:nt:te:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ\u002fwl5YC3hMzIjEkaRfUiyiWaZuQ==;\u002fsites\u002fpub1||`1|0"
 },54,{
 "IsNull":false
 },55,{
 "_ObjectIdentity_":"c9a9c738-3bb7-475b-83f4-7edbc963099e:nt:te:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ\u002fwl5M6T6hz5OAEWqW+BDMLEqzQ==;\u002fsites\u002fpub1||`1|0"
 },57,{
 "IsNull":false
 },58,{
 "_ObjectIdentity_":"c9a9c738-3bb7-475b-83f4-7edbc963099e:nt:te:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ\u002fwl5pWBe2jnTyUSMj6fm6qLVhw==;\u002fsites\u002fpub1||`1|0"
 },60,{
 "IsNull":false
 },61,{
 "_ObjectIdentity_":"c9a9c738-3bb7-475b-83f4-7edbc963099e:nt:te:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ\u002fwl5v1EK0xuntUWuHpRTJ99vSQ==;\u002fsites\u002fpub1||`1|0"
 },63,{
 "IsNull":false
 },64,{
 "_ObjectIdentity_":"c9a9c738-3bb7-475b-83f4-7edbc963099e:nt:te:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ\u002fwl5RvEIdD5ihEOlOuwKjDmheg==;\u002fsites\u002fpub1||`1|0"
 },66,{
 "IsNull":false
 },67,{
 "_ObjectIdentity_":"c9a9c738-3bb7-475b-83f4-7edbc963099e:nt:te:TKE6KUAnlkq7BYswGJADmeRWdF1GK2tPuhG99p0rWMckzELn5mmOQoHKFWEZ\u002fwl56Lk2Im5d\u002fEK\u002fR0mgKvHKTg==;\u002fsites\u002fpub1||`1|0"
 }
 ]