Microsoft Content Management Server - Connected postings and CreatedDate

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > December 2004 > Connected postings and CreatedDate





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 Connected postings and CreatedDate
Morten Hansen

2004-12-29, 7:49 am

Hi

I want to distinguish the "original" posting from its connected
postings. By "original" I mean the first created.

It seems like the ".CreatedDate" property is the same for all the
postings, so this property cannot be used.

The "original" in the following code is always null after running,
because "connectedPosting.CreatedDate" and "firstCreated" are always
equal.

PostingCollection connectedPostingList =
CmsHttpContext.Current.Posting.ConnectedPostings;
DateTime firstCreated = CmsHttpContext.Current.Posting.CreatedDate;
Posting original = null;
foreach (Posting connectedPosting in connectedPostingList)
{
if (connectedPosting.CreatedDate.Ticks < firstCreated.Ticks)
{
original = connectedPosting;
firstCreated = connectedPosting.CreatedDate;
}
}

Is there another way?

Regards,
Morten
Stefan [MSFT]

2004-12-29, 8:46 pm

Hi Morton,

I'm not sure if there is a reliable way to identify the first created
posting.
What you could do is to look at the start date.
This is unique for every posting and if you did not modify it it will have
the date the posting has been created.

Cheers,
Stefan.


"Morten Hansen" <boedtkjer@hotmail.com> wrote in message
news:f10a46b.0412290425.43f828f3@posting.google.com...
> Hi
>
> I want to distinguish the "original" posting from its connected
> postings. By "original" I mean the first created.
>
> It seems like the ".CreatedDate" property is the same for all the
> postings, so this property cannot be used.
>
> The "original" in the following code is always null after running,
> because "connectedPosting.CreatedDate" and "firstCreated" are always
> equal.
>
> PostingCollection connectedPostingList =
> CmsHttpContext.Current.Posting.ConnectedPostings;
> DateTime firstCreated = CmsHttpContext.Current.Posting.CreatedDate;
> Posting original = null;
> foreach (Posting connectedPosting in connectedPostingList)
> {
> if (connectedPosting.CreatedDate.Ticks < firstCreated.Ticks)
> {
> original = connectedPosting;
> firstCreated = connectedPosting.CreatedDate;
> }
> }
>
> Is there another way?
>
> Regards,
> Morten



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com