07-09-07 06:22 PM
Hi Stefan,
Yes I am doing this from within a web application.
Given below is the code, I have put a comment in ALL CAPS for the line that
causes the problem.
private Posting CopyContent(Posting sourcePosting, Posting targetPosting)
{
foreach (Microsoft.ContentManagement.Publishing.Placeholder plc
in sourcePosting.Placeholders)
{
if (plc is
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.ImagePlacehol
der)
{
ImagePlaceholder sourcePlc = plc as ImagePlaceholder;
ImagePlaceholder targetPlc =
targetPosting.Placeholders[sourcePlc.Name] as ImagePlaceholder;
targetPlc.Alt = sourcePlc.Alt;
targetPlc.Href = sourcePlc.Href;
targetPlc.Src = sourcePlc.Src;
}
else if (plc is
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.HtmlPlacehold
er)
{
HtmlPlaceholder sourcePlc = plc as HtmlPlaceholder;
HtmlPlaceholder targetPlc =
targetPosting.Placeholders[sourcePlc.Name] as HtmlPlaceholder;
string sourceHtml = sourcePlc.Html;
//FOR ONE OF THE PLACEHOLDERS THE LINE BELOW CAUSES THE //PROBLEM THE REST
WORKS
targetPlc.Html = sourceHtml;
}
else if (plc is
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.AttachmentPla
ceholder)
{
AttachmentPlaceholder sourcePlc = plc as
AttachmentPlaceholder;
AttachmentPlaceholder targetPlc =
targetPosting.Placeholders[sourcePlc.Name] as AttachmentPlaceholder;
targetPlc.AttachmentText = sourcePlc.AttachmentText;
targetPlc.IconUrl = sourcePlc.IconUrl;
targetPlc.Url = sourcePlc.Url;
}
else if (plc is
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.XmlPlaceholde
r)
{
XmlPlaceholder sourcePlc = plc as XmlPlaceholder;
XmlPlaceholder targetPlc =
targetPosting.Placeholders[sourcePlc.Name] as XmlPlaceholder;
if (sourcePlc.XmlAsString.Trim() != string.Empty)
{
targetPlc.XmlAsString = sourcePlc.XmlAsString;
}
}
}
foreach (Microsoft.ContentManagement.Publishing.CustomProperty
customProperty in sourcePosting.CustomProperties)
{
targetPosting.CustomProperties[customProperty.Name].Value =
customProperty.Value;
}
targetPosting.DisplayName = sourcePosting.DisplayName;
targetPosting.Description = sourcePosting.Description;
targetPosting.StartDate = sourcePosting.StartDate;
targetPosting.ExpiryDate = sourcePosting.ExpiryDate;
targetPosting.IsImportant = sourcePosting.IsImportant;
targetPosting.IsHiddenModePublished =
sourcePosting.IsHiddenModePublished;
targetPosting.IsRobotIndexable = sourcePosting.IsRobotIndexable;
targetPosting.IsRobotFollowable = sourcePosting.IsRobotFollowable;
return targetPosting;
}
I belive the problem is with the following content in one of the Placeholder
s
<P><A
href=\"/NR/exeres/B0844A4F-B579-47CA-B8B2-155367C737F1.htm?NRMODE=Unpublishe
d&WBCMODE=PresentationUnpublished\">Hotel
History</A> <A
href=\"/EN_FA/Property/MAC/slideshowposting.htm?DisplayType=Popup\"
target=\"_blank\">Slideshow</A></P>\r\n<P><A
href=\"/NR/exeres/1968BDD0-731D-4851-AAF9-A646308E5AA4.htm?NRMODE=Unpublishe
d&WBCMODE=PresentationUnpublished\">Special
Events</A></P>\r\n<P> </P>\r\n<P>Balamu</P>
If I put a different content into the same Placeholder then it seems to work
fine. And if I put this same (above content) into a different Placeholder
that worked before then it crashes at that point.
Can you please tell me what is going wrong.
Thanks
Arjuna.
"Stefan Goßner [MSFT]" wrote:
> Hi Arjuna,
>
> sounds like a coding problem.
> Are you doing this from within a web application?
> Then please check your workflow events.
> If this is a standalone application, please paste the complete code here.
>
> Cheers,
> Stefan
>
> "Arjuna" <Arjuna@discussions.microsoft.com> wrote in message
> news:37061CE0-2CEE-40FB-A3A3-F4EB2746D084@microsoft.com...
>
>
>
[ Post a follow-up to this message ]
|