Microsoft Content Management Server - erver error. Contact the site administrator. Source: Resolution Object Model

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > August 2005 > erver error. Contact the site administrator. Source: Resolution Object Model





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 erver error. Contact the site administrator. Source: Resolution Object Model
hemlata_shah@yahoo.com

2005-08-22, 5:57 pm

Hi Stephan
I am running out into a problem while submitting a posting.
I am using HTML Placeholders on the template there are some custom
properties.
There is TreeNodeCollection which we use to show the posting.

We are using the following code in btnTopSaveforPreview_Click()
posting.Approve();
AppContext.CommitAll();
posting.ReleaseOwnership();
AppContext.CommitAll();
On clicking the Preview button, btnTopSaveforPreview_Click() is invoked
We get a error "Exception: System.Runtime.InteropServices.COMException
Message: Server error. Contact the site administrator. Source:
Resolution Object Model at
Microsoft.ContentManagement.Interop.Publishing.IRcwPlaceholder.set_RawContent(String
RawContent) at
Microsoft.ContentManagement.Publishing.DefaultPlaceholderDatasource.set_RawContent(String
value) at
TF.ML.Online.ContentMgmtPub.userControls.Admin.CMAManageContentType.btnTopSaveforPreview_Click(Object
sender, EventArgs e)"

Can you plz let me what exactly can be the problem?
This a bit urgent, as this is happening on one of the production
server....
Any help on this would be highly appreciated.

Regards
HS

Shawn

2005-08-22, 5:57 pm

I'm not Stefan but...

I have a few questions:
1) Is this a new posting or an existing posting?
2) What permissions does the user executing the code have?
3) Are you affecting the values inside the placeholders on the posting?
4) Is the application a web-based application or WinForm?

It's a little unclear exactly what you're trying to accomplish and
what's happening, in code, beyond the snippet your provided.

Shawn

Stefan [MSFT]

2005-08-22, 5:57 pm

Hi HS,

the call stack shows that a placeholder is being updated from inside the
btnTopSaveforPreview event.
And here something goes wrong.

Is there some code you did not list below?
Or are there workflow events registered? Then please disable them and test
again.

Cheers,
Stefan

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

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------


<hemlata_shah@yahoo.com> wrote in message
news:1124735065.322076.191040@g43g2000cwa.googlegroups.com...
> Hi Stephan
> I am running out into a problem while submitting a posting.
> I am using HTML Placeholders on the template there are some custom
> properties.
> There is TreeNodeCollection which we use to show the posting.
>
> We are using the following code in btnTopSaveforPreview_Click()
> posting.Approve();
> AppContext.CommitAll();
> posting.ReleaseOwnership();
> AppContext.CommitAll();
> On clicking the Preview button, btnTopSaveforPreview_Click() is invoked
> We get a error "Exception: System.Runtime.InteropServices.COMException
> Message: Server error. Contact the site administrator. Source:
> Resolution Object Model at
> Microsoft.ContentManagement.Interop.Publishing.IRcwPlaceholder.set_RawContent(String
> RawContent) at
> Microsoft.ContentManagement.Publishing.DefaultPlaceholderDatasource.set_RawContent(String
> value) at
> TF.ML.Online.ContentMgmtPub.userControls.Admin.CMAManageContentType.btnTopSaveforPreview_Click(Object
> sender, EventArgs e)"
>
> Can you plz let me what exactly can be the problem?
> This a bit urgent, as this is happening on one of the production
> server....
> Any help on this would be highly appreciated.
>
> Regards
> HS
>



hemlata_shah@yahoo.com

2005-08-23, 5:53 pm

private void btnTopSaveforPreview_Click(object sender, System.EventArgs
e)
{
try
{

string historychannels =
posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent;
string selectedchannels =
posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent;

// Creating he XML for Channel Tree

TreeNodeCollection nodes = ChannelTree.Nodes;
this.SelectedChannels = null;
this.SelectedChannels = new StringCollection();

foreach(TreeNode node in nodes)
{
this.getAllSelectedChannels(node);
}


// You now have the set of selected channels in the collection
// SelectedChannels

// Save the channels in the XMLPlaceHolderControl
XmlDocument xmlChannels = new XmlDocument();
XmlNode xmlnode;
XmlElement element;

// Creating the XML Structure
xmlChannels.LoadXml("<Channels></Channels>");

foreach(string chSelectedChannels in SelectedChannels)
{
xmlnode = xmlChannels.CreateNode(XmlNodeType.Element, "Channel",""
);
xmlnode.InnerText = chSelectedChannels;
element = xmlChannels.DocumentElement;
element.AppendChild(xmlnode);

}

// Persisting SelectedChannelsHistory in SelectedChannels

historychannels =
posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent;
selectedchannels =
posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent;

posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent
= "<Channels></Channels>";
posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent
= xmlChannels.InnerXml;

posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent
= "<Channels></Channels>";
if(selectedchannels.Length>0)
posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent
= selectedchannels;


// Setting the Posting Status to Saved. Production/ContentTypes
posting.CustomProperties["ProcessStatus"].Value = "Saved";
posting.CustomProperties["IsInPreview"].Value = "1";
posting.CustomProperties["IsInProduction"].Value = "0";

// Setting the Posting Status to Saved. Initial Setup Properties
initposting.CustomProperties["ProcessStatus"].Value = "Saved";
initposting.CustomProperties["IsInPreview"].Value = "1";
initposting.CustomProperties["IsInProduction"].Value = "0";

// Call procedure for Admin and Saved
this.EnableForAdmin_Saved();

posting.Approve();
initposting.Approve();

AppContext.CommitAll();
posting.ReleaseOwnership();
initposting.ReleaseOwnership();
AppContext.CommitAll();

// Showing message to the user
string message =
context.SystemMessages. GetMessage(SystemMessagesCustomizationPa
rameters.MessageEnum.MR31);
base.SetMessage(message) ;

}
catch(Exception excep)
{
// Handle Exception here
base.SetError(excep);
}

# region Posting in Site Map
// From here

try
{
// Call getAllSelectedChannels
// All Selected channels can be accessed by calling the
getAllSelectedChannels()
string selectedChannelList =
posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent ;

string currentHistorychannels =
posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent;

if(selectedChannelList.Length==0)
{
selectedChannelList = "<channels></channels>";
}

if(currentHistorychannels.Length==0)
{
currentHistorychannels = "<channels></channels>";
}

StringCollection deSelectedChannels = new StringCollection();

Template tTemplate = (Template)
AppContext.Searches.GetByPath("/Templates/lol/sec/en/Shared/Template1H");

string prodarticleguid = posting.Guid;

XmlDocument xmlChannels = new XmlDocument();
xmlChannels.LoadXml(selectedChannelList);

XmlDocument xmlHistoryChannels = new XmlDocument();
xmlHistoryChannels.LoadXml(currentHistorychannels);

string channel = string.Empty ;
Channel prodChannel = null;

CopyPostingDao copyDao = (CopyPostingDao)
base.GetDao(typeof(CopyPostingDao));

bool channelDeselected = true;

foreach(XmlElement historyElement in
xmlHistoryChannels.GetElementsByTagName("Channel"))
{
channelDeselected = true;
foreach(XmlElement selectedElement in
xmlChannels.GetElementsByTagName("Channel"))
{
if(selectedElement.InnerText == historyElement.InnerText)
{
channelDeselected = false;
break;
}
}

if (channelDeselected)
{
// This element was deselected
deSelectedChannels.Add(historyElement.InnerXml);
channel = historyElement.InnerText;
prodChannel = (Channel) AppContext.Searches.GetByPath(channel);

prodPosting = (Posting)
AppContext.Searches.GetByPath(channel+posting.Name);
if(prodPosting!=null)
{
prodPosting.Delete();
AppContext.CommitAll();
}
}

}

channel = null;

foreach(XmlElement element in
xmlChannels.GetElementsByTagName("Channel"))
{
// Create Posting using Template1h in the selected Channels
channel = element.InnerText;
prodChannel = (Channel) AppContext.Searches.GetByPath(channel);
// Checking if the Posting exists already, if so, we dont make any
changes
// Otherwise, we create a New Posting using Template1h
prodPosting = (Posting)
AppContext.Searches.GetByPath(channel+posting.Name);
if(prodPosting==null)
{
prodPosting = prodChannel.CreatePosting(tTemplate);

}
else
{
prodPosting.Delete();
AppContext.CommitAll();

prodPosting = prodChannel.CreatePosting(tTemplate);


}

// Name the posting same as the Preview/Article Posting Name
prodPosting.Name = posting.Name;
prodPosting.DisplayName =
RemoveHtmlSUPTags(posting.Placeholders["htmlTitle"].Datasource.RawContent.ToString());
string enddate = posting.CustomProperties["EndDate"].Value;
if(enddate.Length>0)
{
prodPosting.ExpiryDate = DateTime.Parse(enddate);
}

// Set the Prod Posting Object name as the Posting Object name
prodPosting.CustomProperties["ObjectName"].Value =
posting.CustomProperties["ObjectName"].Value;

// Setting the Page ID of the Posting
if(prodPosting.Path.IndexOf("/SiteMap/ProductsandPlanning/") <= 0)
prodPosting.CustomProperties["PageID"].Value =
"og/Online/ContentManagement/Articles/Standard";
else
prodPosting.CustomProperties["PageID"].Value =
"og/Online/ContentManagement/Articles/ProdPlanArticle";


// Set IsInProduction Property
prodPosting.CustomProperties["IsInProduction"].Value = "0";

// Set IsInPreview Property
prodPosting.CustomProperties["IsInPreview"].Value = "1";

// Set the Article GUID Custom Property

// for enabling the Article Conroller to pickup the correct GUID
// and for solving the issues about inconsistent GUIDs during
replications
// prodPosting.CustomProperties["ArticleGUID"].Value =
posting.Guid ;
prodPosting.CustomProperties["ArticleGUID"].Value =
posting.CustomProperties["SourceGUID"].Value;

// Approve, Commit and release ownership
// Possiblity of multi-object commit - can show up here -
prodPosting.Approve();
AppContext.CommitAll();
prodPosting.ReleaseOwnership();
AppContext.CommitAll();

}
}
catch(Exception excep)
{
// Handle Exception here
base.SetError(excep);
}

# endregion


}

Stefan [MSFT]

2005-08-23, 5:53 pm

Hi,

never use datasource.rawcontent to update a placeholder!
See here for details:

http://blogs.technet.com/stefan_gos.../24/119546.aspx

Please replace these references with the correctly casted placeholder
references.

If the problem still occurs, please attach VS.NET as debugger to the process
and step through the routine to see which of the placeholders is causing the
problem.

Btw: the posting object is not initialized in this method. Where do you set
this object?
Which mode is the CmsContext in when this code is being executed?

Cheers,
Stefan

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

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------


<hemlata_shah@yahoo.com> wrote in message
news:1124821941.498973.224460@g44g2000cwa.googlegroups.com...
> private void btnTopSaveforPreview_Click(object sender, System.EventArgs
> e)
> {
> try
> {
>
> string historychannels =
> posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent;
> string selectedchannels =
> posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent;
>
> // Creating he XML for Channel Tree
>
> TreeNodeCollection nodes = ChannelTree.Nodes;
> this.SelectedChannels = null;
> this.SelectedChannels = new StringCollection();
>
> foreach(TreeNode node in nodes)
> {
> this.getAllSelectedChannels(node);
> }
>
>
> // You now have the set of selected channels in the collection
> // SelectedChannels
>
> // Save the channels in the XMLPlaceHolderControl
> XmlDocument xmlChannels = new XmlDocument();
> XmlNode xmlnode;
> XmlElement element;
>
> // Creating the XML Structure
> xmlChannels.LoadXml("<Channels></Channels>");
>
> foreach(string chSelectedChannels in SelectedChannels)
> {
> xmlnode = xmlChannels.CreateNode(XmlNodeType.Element, "Channel",""
> );
> xmlnode.InnerText = chSelectedChannels;
> element = xmlChannels.DocumentElement;
> element.AppendChild(xmlnode);
>
> }
>
> // Persisting SelectedChannelsHistory in SelectedChannels
>
> historychannels =
> posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent;
> selectedchannels =
> posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent;
>
> posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent
> = "<Channels></Channels>";
> posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent
> = xmlChannels.InnerXml;
>
> posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent
> = "<Channels></Channels>";
> if(selectedchannels.Length>0)
> posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent
> = selectedchannels;
>
>
> // Setting the Posting Status to Saved. Production/ContentTypes
> posting.CustomProperties["ProcessStatus"].Value = "Saved";
> posting.CustomProperties["IsInPreview"].Value = "1";
> posting.CustomProperties["IsInProduction"].Value = "0";
>
> // Setting the Posting Status to Saved. Initial Setup Properties
> initposting.CustomProperties["ProcessStatus"].Value = "Saved";
> initposting.CustomProperties["IsInPreview"].Value = "1";
> initposting.CustomProperties["IsInProduction"].Value = "0";
>
> // Call procedure for Admin and Saved
> this.EnableForAdmin_Saved();
>
> posting.Approve();
> initposting.Approve();
>
> AppContext.CommitAll();
> posting.ReleaseOwnership();
> initposting.ReleaseOwnership();
> AppContext.CommitAll();
>
> // Showing message to the user
> string message =
> context.SystemMessages. GetMessage(SystemMessagesCustomizationPa
rameters.MessageEnum.MR31);
> base.SetMessage(message) ;
>
> }
> catch(Exception excep)
> {
> // Handle Exception here
> base.SetError(excep);
> }
>
> # region Posting in Site Map
> // From here
>
> try
> {
> // Call getAllSelectedChannels
> // All Selected channels can be accessed by calling the
> getAllSelectedChannels()
> string selectedChannelList =
> posting.Placeholders["htmlSelectedChannels"].Datasource.RawContent ;
>
> string currentHistorychannels =
> posting.Placeholders["htmlSelectedChannelsHistory"].Datasource.RawContent;
>
> if(selectedChannelList.Length==0)
> {
> selectedChannelList = "<channels></channels>";
> }
>
> if(currentHistorychannels.Length==0)
> {
> currentHistorychannels = "<channels></channels>";
> }
>
> StringCollection deSelectedChannels = new StringCollection();
>
> Template tTemplate = (Template)
> AppContext.Searches.GetByPath("/Templates/lol/sec/en/Shared/Template1H");
>
> string prodarticleguid = posting.Guid;
>
> XmlDocument xmlChannels = new XmlDocument();
> xmlChannels.LoadXml(selectedChannelList);
>
> XmlDocument xmlHistoryChannels = new XmlDocument();
> xmlHistoryChannels.LoadXml(currentHistorychannels);
>
> string channel = string.Empty ;
> Channel prodChannel = null;
>
> CopyPostingDao copyDao = (CopyPostingDao)
> base.GetDao(typeof(CopyPostingDao));
>
> bool channelDeselected = true;
>
> foreach(XmlElement historyElement in
> xmlHistoryChannels.GetElementsByTagName("Channel"))
> {
> channelDeselected = true;
> foreach(XmlElement selectedElement in
> xmlChannels.GetElementsByTagName("Channel"))
> {
> if(selectedElement.InnerText == historyElement.InnerText)
> {
> channelDeselected = false;
> break;
> }
> }
>
> if (channelDeselected)
> {
> // This element was deselected
> deSelectedChannels.Add(historyElement.InnerXml);
> channel = historyElement.InnerText;
> prodChannel = (Channel) AppContext.Searches.GetByPath(channel);
>
> prodPosting = (Posting)
> AppContext.Searches.GetByPath(channel+posting.Name);
> if(prodPosting!=null)
> {
> prodPosting.Delete();
> AppContext.CommitAll();
> }
> }
>
> }
>
> channel = null;
>
> foreach(XmlElement element in
> xmlChannels.GetElementsByTagName("Channel"))
> {
> // Create Posting using Template1h in the selected Channels
> channel = element.InnerText;
> prodChannel = (Channel) AppContext.Searches.GetByPath(channel);
> // Checking if the Posting exists already, if so, we dont make any
> changes
> // Otherwise, we create a New Posting using Template1h
> prodPosting = (Posting)
> AppContext.Searches.GetByPath(channel+posting.Name);
> if(prodPosting==null)
> {
> prodPosting = prodChannel.CreatePosting(tTemplate);
>
> }
> else
> {
> prodPosting.Delete();
> AppContext.CommitAll();
>
> prodPosting = prodChannel.CreatePosting(tTemplate);
>
>
> }
>
> // Name the posting same as the Preview/Article Posting Name
> prodPosting.Name = posting.Name;
> prodPosting.DisplayName =
> RemoveHtmlSUPTags(posting.Placeholders["htmlTitle"].Datasource.RawContent.ToString());
> string enddate = posting.CustomProperties["EndDate"].Value;
> if(enddate.Length>0)
> {
> prodPosting.ExpiryDate = DateTime.Parse(enddate);
> }
>
> // Set the Prod Posting Object name as the Posting Object name
> prodPosting.CustomProperties["ObjectName"].Value =
> posting.CustomProperties["ObjectName"].Value;
>
> // Setting the Page ID of the Posting
> if(prodPosting.Path.IndexOf("/SiteMap/ProductsandPlanning/") <= 0)
> prodPosting.CustomProperties["PageID"].Value =
> "og/Online/ContentManagement/Articles/Standard";
> else
> prodPosting.CustomProperties["PageID"].Value =
> "og/Online/ContentManagement/Articles/ProdPlanArticle";
>
>
> // Set IsInProduction Property
> prodPosting.CustomProperties["IsInProduction"].Value = "0";
>
> // Set IsInPreview Property
> prodPosting.CustomProperties["IsInPreview"].Value = "1";
>
> // Set the Article GUID Custom Property
>
> // for enabling the Article Conroller to pickup the correct GUID
> // and for solving the issues about inconsistent GUIDs during
> replications
> // prodPosting.CustomProperties["ArticleGUID"].Value =
> posting.Guid ;
> prodPosting.CustomProperties["ArticleGUID"].Value =
> posting.CustomProperties["SourceGUID"].Value;
>
> // Approve, Commit and release ownership
> // Possiblity of multi-object commit - can show up here -
> prodPosting.Approve();
> AppContext.CommitAll();
> prodPosting.ReleaseOwnership();
> AppContext.CommitAll();
>
> }
> }
> catch(Exception excep)
> {
> // Handle Exception here
> base.SetError(excep);
> }
>
> # endregion
>
>
> }
>



hemlata_shah@yahoo.com

2005-08-23, 5:53 pm

Thanx a lot Stefan for the info.
the posting object is not initialized in this method. Where do you set
this object? - its been initialized in the page load...
CmsContext Mode is in Saved mode...
I will just go thru ur reply and get back if any queires...

Thanks
Regards
HS

Stefan [MSFT]

2005-08-23, 5:53 pm

Hi HS,

that is not the CmsContext mode that is the Posting state.
If you are using the CmsHttpContext then I assume that the mode is either
published or unpublished and not update.
Only in update mode you will be able to update placeholder content.

Please double check: CmsHttpContext.Current.Mode is what needs to be
checked.

Cheers,
Stefan

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

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------


<hemlata_shah@yahoo.com> wrote in message
news:1124825616.608409.261710@o13g2000cwo.googlegroups.com...
> Thanx a lot Stefan for the info.
> the posting object is not initialized in this method. Where do you set
> this object? - its been initialized in the page load...
> CmsContext Mode is in Saved mode...
> I will just go thru ur reply and get back if any queires...
>
> Thanks
> Regards
> HS
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com