| 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
>
>
|