looping thru a current channel and ...
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > looping thru a current channel and ...




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    looping thru a current channel and ...  
Pete


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-22-05 10:50 PM

get all the subchannels and postings in that current
channel.

Will someone pls give a code snippet on how to do this?
Thanks.





[ Post a follow-up to this message ]



    Re: looping thru a current channel and ...  
Kyong Kwak


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-22-05 10:50 PM

look at AllChildren under channel then check if it's a Channel type then
repeat...


"Pete" <anonymous@discussions.microsoft.com> wrote in message
news:087601c51930$edb1bc20$a601280a@phx.gbl...
> get all the subchannels and postings in that current
> channel.
>
> Will someone pls give a code snippet on how to do this?
> Thanks.







[ Post a follow-up to this message ]



    Re: looping thru a current channel and ...  
Mei Ying [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-23-05 07:50 AM

Hi

Here's some sample code that may help:

private void WalkTree(Channel c)
{
foreach(ChannelItem ci in c.AllChildren)
{
if(ci is Posting)
{
Posting p = ci as Posting;
//Process posting
}
else if(ci is Channel)
{
Channel cc = ci as Channel;
//Process sub channel
//If you need to iterate through
the tree recursively, uncomment the line below
//WalkTree(cc);
}
}
}

regards
Mei Ying
---
Blog: http://meiyinglim.blogspot.com
Book: http://www.packtpub.com/book/mcms
Contact: meiyinglim@hotmail.com
---
>-----Original Message-----
>look at AllChildren under channel then check if it's a
Channel type then
>repeat...
>
>
>"Pete" <anonymous@discussions.microsoft.com> wrote in
message
>news:087601c51930$edb1bc20$a601280a@phx.gbl... 
>
>
>.
>





[ Post a follow-up to this message ]



    Re: looping thru a current channel and ...  
Pete


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-23-05 10:59 PM

Thanks. For someone new to MCMS, I am very much
appreciative of your help.

>-----Original Message-----
>Hi
>
>Here's some sample code that may help:
>
>private void WalkTree(Channel c)
>{
>	foreach(ChannelItem ci in c.AllChildren)
>	{
>		if(ci is Posting)
>		{
>			Posting p = ci as Posting;
>			//Process posting
>		}
>		else if(ci is Channel)
>		{
>			Channel cc = ci as Channel;
>			//Process sub channel
>			//If you need to iterate through
>the tree recursively, uncomment the line below
>			//WalkTree(cc);
>		}
>	}
>}
>
>regards
>Mei Ying
>---
>Blog: http://meiyinglim.blogspot.com
>Book: http://www.packtpub.com/book/mcms
>Contact: meiyinglim@hotmail.com
>--- 
>Channel type then 
>message 
this?[vbcol=seagreen] 
>.
>





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:49 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register