Skip to content
All gists
Back to GitHub
Sign in
Sign up
Sign in
Sign up
{{ message }}
Instantly share code, notes, and snippets.
vgrem
/
PortalNavigationSamples2.cs
Last active
Dec 26, 2015
Star
0
Fork
0
Star
Code
Revisions
3
Embed
What would you like to do?
Embed
Embed this gist in your website.
Share
Copy sharable link for this gist.
Clone via HTTPS
Clone with Git or checkout with SVN using the repository’s web address.
Learn more about clone URLs
Download ZIP
The following examples demonstrate how to access and manipulate Navigation settings via CSOM
Raw
PortalNavigationSamples2.cs
namespace
Publishing
.
Navigation
.
Client
.
Samples
{
class
PortalNavigation
{
///
<
summary
>
///
Print Navigation settings
///
</
summary
>
///
<
param
name
=
"
url
"
></
param
>
///
<
returns
></
returns
>
public
static
void
PrintNavigationSettings
(
string
url
)
{
using
(
var
clientContext
=
new
ClientContext
(
url
))
{
var
navigation
=
new
ClientPortalNavigation
(
clientContext
.
Web
);
Console
.
WriteLine
(
"
CurrentIncludePages: {0}
"
,
navigation
.
CurrentIncludePages
);
Console
.
WriteLine
(
"
GlobalIncludePages: {0}
"
,
navigation
.
GlobalIncludePages
);
Console
.
WriteLine
(
"
OrderingMethod: {0}
"
,
navigation
.
OrderingMethod
);
Console
.
WriteLine
(
"
AutomaticSortingMethod: {0}
"
,
navigation
.
AutomaticSortingMethod
);
Console
.
WriteLine
(
"
SortAscending: {0}
"
,
navigation
.
SortAscending
);
Console
.
WriteLine
(
"
GlobalIncludeSubSites: {0}
"
,
navigation
.
GlobalIncludeSubSites
);
Console
.
WriteLine
(
"
CurrentIncludeSubSites: {0}
"
,
navigation
.
CurrentIncludeSubSites
);
}
}
///
<
summary
>
///
Update Navigation settings
///
</
summary
>
///
<
param
name
=
"
url
"
></
param
>
public
static
void
UpdateNavigationSettings
(
string
url
)
{
using
(
var
clientContext
=
new
ClientContext
(
url
))
{
var
navigation
=
new
ClientPortalNavigation
(
clientContext
.
Web
);
navigation
.
CurrentIncludePages
=
true
;
navigation
.
GlobalIncludePages
=
false
;
navigation
.
SaveChanges
();
}
}
}
}
Sign up for free
to join this conversation on GitHub
. Already have an account?
Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.