| Stefan [MSFT] 2004-06-20, 11:04 pm |
| Hi Randall,
you have created a new CmsApplicationContext but you are accessing the
posting using the CmsHttpContext.
Only the CmsApplicationContext is in update mode. Not the CmsHttpContext.
Use this code:
> CmsApplicationContext AppContext = new CmsApplicationContext();
> AppContext.AuthenticateAsCurrentUser( PublishingMode.Update );
> Posting p =
AppContext.Searches.GetByGuid(CmsHttpContext.Current.Posting.Guid)
> p.MoveTo(pDesChannel);
> AppContext.CommitAll();
> AppContext.Dispose();
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights.
MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver
--------------------------------
"Randall" <Randall@discussions.microsoft.com> wrote in message
news:50C4CCC3-A456-46BA-A093-C4940EA349EB@microsoft.com...
> Hi all,
>
> I want to write some code which will allow the user to move a page from
one channel to another. I found this code in the documentation.
> CmsApplicationContext AppContext = new CmsApplicationContext();
> AppContext.AuthenticateAsCurrentUser( PublishingMode.Update );
> CmsHttpContext.Current.Posting.MoveTo(pDesChannel);
> AppContext.Dispose();
> But it doesn't work.
> I get his 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.
> ======
>
> Has anyone done this before. I would appreciate if someone can provide me
a solution for this.
>
> Regards,
> Randall
>
>
>
>
|