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