Wednesday, March 11, 2015

Navigation Settings through CSOM - Inherit Parent Global Navigation for Subsite - SharePoint 2013

The following code helps to set Navigation Settings through Client side object model (CSOM). 

                //// Get the context for the SharePoint Site to access the data
              using (ClientContext TargetSiteClientContext = new ClientContext(TargetSite))
                            {

                                       TargetSiteClientContext.Credentials = new NetworkCredential(TargetSiteUserName, TargetSitePassword, TargetSiteDomain);
                                       //Inherit Parent Global Navigation for Subsite
                                        TargetSiteClientContext.Web.Navigation.UseShared = true;
                                        TargetSiteClientContext.ExecuteQuery();
                             }

No comments: