Microsoft Content Management Server - Re: Changing the mode

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > June 2004 > Re: Changing the mode





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 Re: Changing the mode
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
>
>
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com