|
Home > Archive > Microsoft Content Management Server > October 2004 > Posting display name
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 |
Posting display name
|
|
| Randall 2004-10-07, 5: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
| |
|
| 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
>
| |
| Randall 2004-10-07, 5: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 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...
>
>
>
| |
|
|
| Randall 2004-10-08, 5: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...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
> 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
>
>
>
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|