Posting display name
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > Posting display name




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Posting display name  
Randall


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-07-04 10:47 PM

Hi all,

I have 10 different channels and they all have one posting by name Posting1.
We have to change the posting display name for all those postings. One way
of doing that is edit the posting and change its display name.

I was trying to write a code something like this so that we don't have to
edit all the postings.
CmsApplicationContext AppContext = new CmsApplicationContext();
AppContext.AuthenticateAsCurrentUser( PublishingMode.Update );
foreach(Channel ch in channelMain.Channels)
{
foreach(Posting p in ch.Postings)
{
if(p.Name=="posting1")
{
pTarget=p;
break;
}
}

Posting p1 =AppContext.Searches.GetByGuid(pTarget.Guid) as Posting ;
p1.DisplayName="new name";

}
AppContext.CommitAll();
AppContext.Dispose();

It works on my machine but didn't work on production machine.
I got the Login failed error.

Any suggestion?
I appreciate your help.

Regards,
Randall






[ Post a follow-up to this message ]



    Re: Posting display name  
AC


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-07-04 10:47 PM

When you run it on your production machine... are you logged in as someone
who has access to the channels you're doing this to?  If you're running it
trough the web and you have guest access, I doubt the guest user you setup
has been granted author rights to the channels.

Because you'r elogging in as "AuthenticateAsCurrentUser" you may have
issues.  Look into using one of the other authentication mech. & passing in
an impersonated user (using a WindowsIdentity principal) or logging in
interactively to the box and running your script through a non-anon website
(or as a console app).

-AC

"Randall" <Randall@discussions.microsoft.com> wrote in message
news:5086AC6D-205D-47DB-AEEB-B6F07A0F75D2@microsoft.com...
> Hi all,
>
> I have 10 different channels and they all have one posting by name
> Posting1.
> We have to change the posting display name for all those postings. One way
> of doing that is edit the posting and change its display name.
>
> I was trying to write a code something like this so that we don't have to
> edit all the postings.
> CmsApplicationContext AppContext = new CmsApplicationContext();
> AppContext.AuthenticateAsCurrentUser( PublishingMode.Update );
> foreach(Channel ch in channelMain.Channels)
> {
> foreach(Posting p in ch.Postings)
> {
> if(p.Name=="posting1")
> {
> pTarget=p;
> break;
> }
> }
>
> Posting p1 =AppContext.Searches.GetByGuid(pTarget.Guid) as Posting ;
> p1.DisplayName="new name";
>
> }
> AppContext.CommitAll();
> AppContext.Dispose();
>
> It works on my machine but didn't work on production machine.
> I got the Login failed error.
>
> Any suggestion?
> I appreciate your help.
>
> Regards,
> Randall
>







[ Post a follow-up to this message ]



    Re: Posting display name  
Randall


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-07-04 10:47 PM

I am logged as an Admin on the production machine also.
How to go about the other approach?
I appreciate your help.

Regards,
Randall

"AC" wrote:

> When you run it on your production machine... are you logged in as someone
> who has access to the channels you're doing this to?  If you're running it
> trough the web and you have guest access, I doubt the guest user you setup
> has been granted author rights to the channels.
>
> Because you'r elogging in as "AuthenticateAsCurrentUser" you may have
> issues.  Look into using one of the other authentication mech. & passing i
n
> an impersonated user (using a WindowsIdentity principal) or logging in
> interactively to the box and running your script through a non-anon websit
e
> (or as a console app).
>
> -AC
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:5086AC6D-205D-47DB-AEEB-B6F07A0F75D2@microsoft.com... 
>
>
>





[ Post a follow-up to this message ]



    Re: Posting display name  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-08-04 12:47 PM

Hi Randall,

are you logged in as CMS admin or as local admin?
You need to be logged in as CMS admin.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Randall" <Randall@discussions.microsoft.com> wrote in message
news:F1A4670C-99D8-4DB6-90A7-75F63F6EA8CE@microsoft.com...[vbcol=seagreen]
> I am logged as an Admin on the production machine also.
> How to go about the other approach?
> I appreciate your help.
>
> Regards,
> Randall
>
> "AC" wrote:
> 
someone[vbcol=seagreen] 
it[vbcol=seagreen] 
setup[vbcol=seagreen] 
in[vbcol=seagreen] 
website[vbcol=seagreen] 
way[vbcol=seagreen] 
to[vbcol=seagreen] 







[ Post a follow-up to this message ]



    Re: Posting display name  
Randall


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-08-04 10:48 PM

Hello Stefan,

Thanks for replying back to me.
I am logged in as CMS admin. But it still doesn't allow me to do it.
Also is it possible to authenticate AppContext.AuthenticateAsCurrentUser(
PublishingMode.Update ) with the current user for the cms ?
I appreciate your help.

Regards,
Randall

"Stefan [MSFT]" wrote:

> Hi Randall,
>
> are you logged in as CMS admin or as local admin?
> You need to be logged in as CMS admin.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>
> MCMS FAQ:
> http://download.microsoft.com/downl...
a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
> http://www.gotdotnet.com/community/...nagement+Server
> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:F1A4670C-99D8-4DB6-90A7-75F63F6EA8CE@microsoft.com... 
> someone 
> it 
> setup 
> in 
> website 
> way 
> to 
>
>
>





[ Post a follow-up to this message ]



    Re: Posting display name  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-08-04 10:48 PM

Hi Randall,

are you doing this inside a web application?
Then AuthenticateAsCurrentUser will not work.
This method only works in a console application.
Here is explanation and workaround:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm#7CE850B8-0F5A-4570-B8E7-3627A65E9056

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Randall" <Randall@discussions.microsoft.com> wrote in message
news:8E4FE78B-BCCF-411D-888B-C4D80A1742CC@microsoft.com...[vbcol=seagreen]
> Hello Stefan,
>
> Thanks for replying back to me.
> I am logged in as CMS admin. But it still doesn't allow me to do it.
>  Also is it possible to authenticate AppContext.AuthenticateAsCurrentUser(
> PublishingMode.Update ) with the current user for the cms ?
> I appreciate your help.
>
> Regards,
> Randall
>
> "Stefan [MSFT]" wrote:
> 
rights.[vbcol=seagreen] 
http://download.microsoft.com/downl...
+Server[vbcol=seagreen] 
running[vbcol=seagreen] 
have[vbcol=seagreen] 
passing[vbcol=seagreen] 
in[vbcol=seagreen] 
One[vbcol=seagreen] 
have[vbcol=seagreen] 
;[vbcol=seagreen] 







[ Post a follow-up to this message ]



    Re: Posting display name  
Randall


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-08-04 10:48 PM

Stefan,

I need to use this code in the cms application where authentication mode is
forms.
Will this work in that case?
CmsApplicationContext cmsContext = new CmsApplicationContext();
FormsIdentity ident = HttpContext.Current.User.Identity as FormsIdentity;
cmsContext.AuthenticateUsingUserHandle(ident.Token,PublishingMode.Update);

Now will it authenticate the logged user using the custom login form?
Or is there any other way to do this?
I appreciate your help.

Regards,
Randall

"Stefan [MSFT]" wrote:

> Hi Randall,
>
> are you doing this inside a web application?
> Then AuthenticateAsCurrentUser will not work.
> This method only works in a console application.
> Here is explanation and workaround:
> http://download.microsoft.com/downl...
a/MCMS+2002+-+(complete)+FAQ.htm#7CE850B8-0F5A-4570-B8E7-3627A65E9056
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>
> MCMS FAQ:
> http://download.microsoft.com/downl...
a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
> http://www.gotdotnet.com/community/...nagement+Server
> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:8E4FE78B-BCCF-411D-888B-C4D80A1742CC@microsoft.com... 
> rights. 
> http://download.microsoft.com/downl...
a/MCMS+2002+-+(complete)+FAQ.htm 
> http://www.gotdotnet.com/community/...nagement+Server 
> running 
> have 
> passing 
> in 
> One 
> have 
> ; 
>
>
>





[ Post a follow-up to this message ]



    Re: Posting display name  
Randall


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-08-04 10:48 PM

Stefan,

Also How to create a console application ?

Regards,
Randall

"Stefan [MSFT]" wrote:

> Hi Randall,
>
> are you doing this inside a web application?
> Then AuthenticateAsCurrentUser will not work.
> This method only works in a console application.
> Here is explanation and workaround:
> http://download.microsoft.com/downl...
a/MCMS+2002+-+(complete)+FAQ.htm#7CE850B8-0F5A-4570-B8E7-3627A65E9056
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>
> MCMS FAQ:
> http://download.microsoft.com/downl...
a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
> http://www.gotdotnet.com/community/...nagement+Server
> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "Randall" <Randall@discussions.microsoft.com> wrote in message
> news:8E4FE78B-BCCF-411D-888B-C4D80A1742CC@microsoft.com... 
> rights. 
> http://download.microsoft.com/downl...
a/MCMS+2002+-+(complete)+FAQ.htm 
> http://www.gotdotnet.com/community/...nagement+Server 
> running 
> have 
> passing 
> in 
> One 
> have 
> ; 
>
>
>





[ Post a follow-up to this message ]



    Re: Posting display name  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-08-04 10:48 PM

Hi Randall,

open VS.NET, choose C# or VB.NET and select Console Application.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Randall" <Randall@discussions.microsoft.com> wrote in message
news:02B1D587-224F-4C5F-8DD2-C8AD6FF2C321@microsoft.com...[vbcol=seagreen]
> Stefan,
>
> Also How to create a console application ?
>
> Regards,
> Randall
>
> "Stefan [MSFT]" wrote:
> 
http://download.microsoft.com/downl...
+Server[vbcol=seagreen] 
AppContext. AuthenticateAsCurrentUser([vbcol=seagree
n] 
http://download.microsoft.com/downl...
+Server[vbcol=seagreen] 
as[vbcol=seagreen] 
you[vbcol=seagreen] 
logging[vbcol=seagreen] 
non-anon[vbcol=seagreen] 
name[vbcol=seagreen] 
postings.[vbcol=seagreen] 
don't[vbcol=seagreen] 
 CmsApplicationContext();[vbcol=seagreen]
 
Posting[vbcol=seagreen] 







[ Post a follow-up to this message ]



    Re: Posting display name  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-08-04 10:48 PM

Hi Randall,

as indicated in this article it will not work.
The only way to get this working with formsauthentication is by hard coding
user credentials.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Randall" <Randall@discussions.microsoft.com> wrote in message
news:065BA1DB-8DAC-4E5D-9D7A-E11E5D181547@microsoft.com...
> Stefan,
>
> I need to use this code in the cms application where authentication mode
is[vbcol=seagreen]
> forms.
> Will this work in that case?
> CmsApplicationContext cmsContext = new CmsApplicationContext();
> FormsIdentity ident = HttpContext.Current.User.Identity as FormsIdentity;
> cmsContext.AuthenticateUsingUserHandle(ident.Token,PublishingMode.Update);
>
> Now will it authenticate the logged user using the custom login form?
> Or is there any other way to do this?
> I appreciate your help.
>
> Regards,
> Randall
>
> "Stefan [MSFT]" wrote:
> 
http://download.microsoft.com/downl...
+Server[vbcol=seagreen] 
AppContext. AuthenticateAsCurrentUser([vbcol=seagree
n] 
http://download.microsoft.com/downl...
+Server[vbcol=seagreen] 
as[vbcol=seagreen] 
you[vbcol=seagreen] 
logging[vbcol=seagreen] 
non-anon[vbcol=seagreen] 
name[vbcol=seagreen] 
postings.[vbcol=seagreen] 
don't[vbcol=seagreen] 
 CmsApplicationContext();[vbcol=seagreen]
 
Posting[vbcol=seagreen] 







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:20 PM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register