Microsoft Content Management Server - Accessing "Hide When Published" channels in-code

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > July 2006 > Accessing "Hide When Published" channels in-code





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Accessing "Hide When Published" channels in-code
Jordan Stradtman

2006-07-25, 7:17 pm

I have a channel structure similar to the following:
Main Channel
- Detail page channel (checked Hide When Published)
*detail page 1
*detail page 2
*...
I have been unable to figure out how to access the hidden channel (and
ultimately it's pages) via code. When I do something similar to
CmsHttpContext.Current.Channel.Channels.Count, it returns a 0 if the detail
channel is hidden.

Any suggestions? It seems silly that just because the channel is hidden,
that it cannot be access via code.

Any assistance would be greatly appreciated.

Jordy
William Cornwill

2006-07-25, 7:17 pm

Hi Jordy,

Hidden items are filtered in published mode, if you need to access them in
this mode then you can set the AutoFilterHidden flag to false. Make sure you
set it back after you have finished.

//Obtain the current filter value
bool IsFiltered = CmsHttpContext.Current.SessionSettings.AutoFilterHidden;
//Set the filter flag so hidden items can be found
CmsHttpContext.Current.SessionSettings.AutoFilterHidden = false;
:
//do you best here
:
//Reset the filter flag back to its original value
CmsHttpContext.Current.SessionSettings.AutoFilterHidden = IsFiltered;

Regards,

William Cornwill


"Jordan Stradtman" wrote:

> I have a channel structure similar to the following:
> Main Channel
> - Detail page channel (checked Hide When Published)
> *detail page 1
> *detail page 2
> *...
> I have been unable to figure out how to access the hidden channel (and
> ultimately it's pages) via code. When I do something similar to
> CmsHttpContext.Current.Channel.Channels.Count, it returns a 0 if the detail
> channel is hidden.
>
> Any suggestions? It seems silly that just because the channel is hidden,
> that it cannot be access via code.
>
> Any assistance would be greatly appreciated.
>
> Jordy

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com