Microsoft Content Management Server - looping thru a current channel and ...

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > February 2005 > looping thru a current channel and ...





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 looping thru a current channel and ...
Pete

2005-02-22, 5: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.
Kyong Kwak

2005-02-22, 5: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.



Mei Ying [MVP]

2005-02-23, 2: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...
>
>
>.
>

Pete

2005-02-23, 5: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]
>.
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com