Microsoft Content Management Server - Set expiry date of the posting programatically

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > June 2006 > Set expiry date of the posting programatically





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 Set expiry date of the posting programatically
Fezmot

2006-06-27, 1:18 pm

Hi

I am asking if it is possible to set the expiry date of the posting
programmatically in C#
I am using this code i want the users to set the expiry date using to
htmplaceholders one for the Datetime and one for the time.


cmsContext.CommitAll();
Posting conPosting = CmsHttpContext.Current.Posting;
conPosting.ExpiryDate = DateTime.Now;//It will be placeholder name.
conPosting.Approve();
cmsContext.CommitAll();


I getting this error.
Invalid mode for update. The requested action modifies the state of an
object and can only be performed when the session is in the 'Update'
mode.


The reason why i am doing that the users dont want to use page property

to set the expiry date

Randall

2006-06-27, 1:18 pm

Hi Fezmot,

Try using CmsApplication context with update mode.
CmsApplicationContext AppContext = new CmsApplicationContext();
AppContext. AuthenticateAsCurrentUser(PublishingMode
.Update );

Randall

"Fezmot" wrote:

> Hi
>
> I am asking if it is possible to set the expiry date of the posting
> programmatically in C#
> I am using this code i want the users to set the expiry date using to
> htmplaceholders one for the Datetime and one for the time.
>
>
> cmsContext.CommitAll();
> Posting conPosting = CmsHttpContext.Current.Posting;
> conPosting.ExpiryDate = DateTime.Now;//It will be placeholder name.
> conPosting.Approve();
> cmsContext.CommitAll();
>
>
> I getting this error.
> Invalid mode for update. The requested action modifies the state of an
> object and can only be performed when the session is in the 'Update'
> mode.
>
>
> The reason why i am doing that the users dont want to use page property
>
> to set the expiry date
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com