Microsoft Content Management Server - How to return a PostingCollection

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > July 2005 > How to return a PostingCollection





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 How to return a PostingCollection
mh

2005-07-14, 7:47 am

hi,
i am trying to sort a postingCollection on the basis of a custom property
(which is of date type, which user will fillin and once he saves the page,
the date is saved as custom property)

Now I need to sort the posting collection and return return a Posting
collection which will contain the sorted postings based on the custom date
which i mentioned above. I am sorting it using bubble sort after storing the
collections to a hashtable.

Here is a portion of code with comments..

//here ht is a hashtable which contains the sorted items
// PostingDate() is a class which contains GUID, customDate.

PostingCollection pChannel;
Channel cChannel = CmsHttpContext.Current.Channel;
for(i=0;i<ht.Count;i++)
{
foreach(Posting p in cChannel.Postings)
{
PostingDate clsDate = new PostingDate();
clsDate = (PostingDate)ht[i];
if(p.Guid.ToString() == clsDate.getGUID.ToString())
{
cChannel = ?
//did'nt get any property like cChannel.Add(p)
// I want to add the posting's "Posting p in
cChannel.Postings"
// I want to add Posting "p" and return the collection
}
}
}


I tried to create a PostingCollection and then add postings to it which i
can later pass it as return parameter to the calling function. But no such
method. I am lost now as how to achieve that.

Thanks in advance
MH
mh

2005-07-14, 7:47 am

I would also appriciate if anybody gives an alternate solution to my problem

"mh" wrote:

> hi,
> i am trying to sort a postingCollection on the basis of a custom property
> (which is of date type, which user will fillin and once he saves the page,
> the date is saved as custom property)
>
> Now I need to sort the posting collection and return return a Posting
> collection which will contain the sorted postings based on the custom date
> which i mentioned above. I am sorting it using bubble sort after storing the
> collections to a hashtable.
>
> Here is a portion of code with comments..
>
> //here ht is a hashtable which contains the sorted items
> // PostingDate() is a class which contains GUID, customDate.
>
> PostingCollection pChannel;
> Channel cChannel = CmsHttpContext.Current.Channel;
> for(i=0;i<ht.Count;i++)
> {
> foreach(Posting p in cChannel.Postings)
> {
> PostingDate clsDate = new PostingDate();
> clsDate = (PostingDate)ht[i];
> if(p.Guid.ToString() == clsDate.getGUID.ToString())
> {
> cChannel = ?
> //did'nt get any property like cChannel.Add(p)
> // I want to add the posting's "Posting p in
> cChannel.Postings"
> // I want to add Posting "p" and return the collection
> }
> }
> }
>
>
> I tried to create a PostingCollection and then add postings to it which i
> can later pass it as return parameter to the calling function. But no such
> method. I am lost now as how to achieve that.
>
> Thanks in advance
> MH

Stefan [MSFT]

2005-07-14, 7:47 am

Hi MH,

it is not possible to create a posting collection.
Either use a generic collection for this or use an array of postings.

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------


"mh" <mh@discussions.microsoft.com> wrote in message
news:5351E604-0506-41F5-9699-8083B1FE54AE@microsoft.com...
> hi,
> i am trying to sort a postingCollection on the basis of a custom property
> (which is of date type, which user will fillin and once he saves the page,
> the date is saved as custom property)
>
> Now I need to sort the posting collection and return return a Posting
> collection which will contain the sorted postings based on the custom date
> which i mentioned above. I am sorting it using bubble sort after storing
> the
> collections to a hashtable.
>
> Here is a portion of code with comments..
>
> //here ht is a hashtable which contains the sorted items
> // PostingDate() is a class which contains GUID, customDate.
>
> PostingCollection pChannel;
> Channel cChannel = CmsHttpContext.Current.Channel;
> for(i=0;i<ht.Count;i++)
> {
> foreach(Posting p in cChannel.Postings)
> {
> PostingDate clsDate = new PostingDate();
> clsDate = (PostingDate)ht[i];
> if(p.Guid.ToString() == clsDate.getGUID.ToString())
> {
> cChannel = ?
> //did'nt get any property like cChannel.Add(p)
> // I want to add the posting's "Posting p in
> cChannel.Postings"
> // I want to add Posting "p" and return the collection
> }
> }
> }
>
>
> I tried to create a PostingCollection and then add postings to it which i
> can later pass it as return parameter to the calling function. But no such
> method. I am lost now as how to achieve that.
>
> Thanks in advance
> MH



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com