The strange thing is, is that it actually publishes fine it just displays an error when it does.
Here are the logs:-
2015-01-27 08:29:27,137 [59] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 39] Content 'Facebook suffers widespread outage' with Id '1467' has been published.
2015-01-27 08:29:27,281 [59] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 39] Content '2015' with Id '0' has been published.
2015-01-27 08:29:27,331 [59] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 39] Content 'January' with Id '0' has been published.
2015-01-27 08:29:27,426 [59] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 39] Content 'Facebook suffers widespread outage' with Id '1467' has been published.
maybe there is a conflict with this packages. But I do not know it currently.
I would do the following:
Install a clean 7.2 version. Customize the content service code and check if that will work.
If yes, install one of the tree packages and check again.
So you can at least locate from when there are problems.
Have anyone in the community seen this error before? Server error: Contact administrator, see log for full details. Values of parentId and docNode/@parentID are different.
private void Document_Publishing(IPublishingStrategy sender, PublishEventArgs<IContent> e)
{
// LETS SET THOSE VARIABLES
bool requestSuccess = false;
var publishedEnts = e.PublishedEntities;
int reviewPendingFolderId = 1452; // HOME > NEWS AND BLOG > PENDING REVIEW
int postsFolderId = 1252; // HOME > NEWS AND BLOG > POSTS
int articleMonth = DateTime.Now.Month; // DEFAULT TO NOW MONTH
int articleYear = DateTime.Now.Year; // DEFAULT TO NOW YEAR
string articleMonthName = string.Empty;
// 1. LETS FIND OUR PAGE
int pageId = publishedEnts.Select(x => x.Id).FirstOrDefault(); // CURRENT PAGE ID
int pageParentId = publishedEnts.Select(x => x.ParentId).FirstOrDefault(); // CURRENT PAGE PARENT ID
IContentType templateType = publishedEnts.Select(x => x.ContentType).FirstOrDefault(); // CURRENT PAGE CONTENT TYPE
// 2. BEFORE WE GO ANY FURTHER LETS MAKE SURE WE'RE ONLY AFFECTING PAGES OF TYPE - SMARTBLOGPOST
if (templateType.Alias == "SmartBlogPost" && pageParentId == reviewPendingFolderId)
{
// 3. BEFORE WE MOVE THE PAGE WE NEED TO CHECK IF THE YEAR/MONTH PARENTS EXISTS - IF THEY DONT LETS CREATE THEM
DateTime pagePublishDate = publishedEnts.Select(x => x.GetValue<DateTime>("smartBlogDate")).FirstOrDefault();
if (pagePublishDate != null)
{
articleMonth = pagePublishDate.Month;
articleYear = pagePublishDate.Year;
articleMonthName = pagePublishDate.ToString("MMMM", CultureInfo.InvariantCulture);
ContentService c = new ContentService();
// CHECK IF YEAR EXISTS
IEnumerable<IContent> matchYearPage = c.GetChildrenByName(postsFolderId, articleYear.ToString());
if (matchYearPage.Count() > 0)
{
// CHECK IF MONTH EXISTS
int yearPageId = matchYearPage.Select(x => x.Id).FirstOrDefault();
IEnumerable<IContent> matchMonthPage = c.GetChildrenByName(yearPageId, articleMonthName.ToString());
if (matchMonthPage.Count() > 0)
{
int monthPageId = matchMonthPage.Select(x => x.Id).FirstOrDefault();
// RUN MOVE ROUTINE
requestSuccess = RunPageSetup(true, true, pageId, postsFolderId, articleYear.ToString(), articleMonthName, yearPageId, monthPageId);
}
else
{
// CREATE MONTH + RUN MOVE ROUTINE
requestSuccess = RunPageSetup(true, false, pageId, postsFolderId, articleYear.ToString(), articleMonthName, yearPageId);
}
}
else
{
// CREATE YEAR + MONTH + RUN MOVE ROUTINE
requestSuccess = RunPageSetup(false, false, pageId, postsFolderId, articleYear.ToString(), articleMonthName);
}
if (!requestSuccess)
{
LogHelper.Info(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "An error occured while attempt to process this article");
}
}
}
}
Unfortunately I can not find anything wrong at the time. I would have replace
monthId = attMonth.Result.ContentItem.Id;
with
monthId = monthContent.Id;
But at first, you had it already so.
Can you tell me the values of content and monthId in cs.Move(content, monthId)? I have asked in my last post above for this. Maybe this helps to find the issue.
And has the variable pageId the correct value of your currentPage?
I'm pretty sure the pageID is correct, as despite the error message everything works as it should, the correct pages get published and the correct page gets moved under those newly created pages.
In my last test, the monthId was 1489 and the content, was what I expected it to be.
I can't debug it locally, so I'm afraid I can't tell you exactly what the values are.
I'm having this issue when I preview content on my umbraco 7.2.8 site.
Values of parentId and docNode/@parentID are different.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Values of parentId and docNode/@parentID are different.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Values of parentId and docNode/@parentID are different.]
umbraco.content.GetAddOrUpdateXmlNode(XmlDocument xml, Int32 id, Int32 level, Int32 parentId, XmlNode docNode) +882
umbraco.presentation.preview.PreviewContent.PrepareDocument(User user, Document documentObject, Boolean includeSubs) +817
umbraco.presentation.dialogs.Preview.Page_Load(Object sender, EventArgs e) +300
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
umbraco.BasePages.BasePage.OnLoad(EventArgs e) +14
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
So far, republishing the entire site and hard publishing the home page (that I was previewing in this case) hasn't solved the problem. As far as I can tell, I am not able to preview any nodes right now.
Ah ha! It doesn't affect every node. It especially does not affect leaf nodes. It looks like umbraco is having trouble previewing a node when one of the node's descendants is having problems. I followed the trail of broken previews all the way down to a leaf blog post. It was unpublished, but there were mandatory fields on it that were not entered. It looks like umbraco gets upset when you manage to save a node without filling out the mandatory fields.
Getting the Id of the page after using CreateContent
Hello,
I'm hoping this is an easy question to answer. I need to return the ID of a newly created page when the following code is run:-
The Save and Publish works fine, but do you know what code I need to get the Id.
I've tried (the below) but that appears to return 0.
Many Thanks
Paul
Hi Paul,
this should be works...
Is the content node actually published?
Which version of umbraco do you use?
Best,
Sören
Hi Sören,
Thanks for your response, I'm using Umbraco 7.2.
The strange thing is, is that it actually publishes fine it just displays an error when it does.
Here are the logs:-
2015-01-27 08:29:27,137 [59] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 39] Content 'Facebook suffers widespread outage' with Id '1467' has been published. 2015-01-27 08:29:27,281 [59] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 39] Content '2015' with Id '0' has been published. 2015-01-27 08:29:27,331 [59] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 39] Content 'January' with Id '0' has been published. 2015-01-27 08:29:27,426 [59] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 39] Content 'Facebook suffers widespread outage' with Id '1467' has been published.
Hi Paul,
there is a similar issue:
http://our.umbraco.org/forum/ourumb-dev-forum/bugs/55049-Error-saving-content
Do you have install any packages that are not compatible with v7? For example the standard website package?
Another possibilitys:
Is a parent node not published?
Do you have any mandatory properties in your document type to publish?
Best,
Sören
Hi Sören,
The error message I get is:-
Server error: Contact administrator, see log for full details. Values of parentId and docNode/@parentID are different.
It's not quite the .net error page as illustrating in the other thread, it's displayed as a little red bar at the bottom.
I have installed: Smart Blog, Dialogue and Contour.
I'm creating parent pages if they don't exist and they should be published before I add a child page to them.
Thanks
Paul
Hi Paul,
maybe there is a conflict with this packages. But I do not know it currently.
I would do the following:
Install a clean 7.2 version. Customize the content service code and check if that will work.
If yes, install one of the tree packages and check again.
So you can at least locate from when there are problems.
Have anyone in the community seen this error before?
Server error: Contact administrator, see log for full details. Values of parentId and docNode/@parentID are different.
Best,
Sören
I've debugged this further and I can see the error is occurring when I run this piece of code (it's the very last piece of code to be run):-
If I comment this out, it all works as expected. After I move a page I get the error.
Any thoughts
Thanks
Paul
Hi Paul,
did you create the new node and call the SaveAndPublish after this lines?
Can you give me more code? I would need a few lines before and a few lines after the last code snippet, that I can see what you will do exactly.
Have you debugged with Visual Studio? Then set a breakpoint at line "cs.Move(content, monthId)" and tell me the values of content and monthId.
Best,
Sören
Sure, here it is:-
And the code that contains the Move is here:-
Hi Paul,
Unfortunately I can not find anything wrong at the time. I would have replace
with
But at first, you had it already so.
Can you tell me the values of content and monthId in cs.Move(content, monthId)? I have asked in my last post above for this. Maybe this helps to find the issue.
And has the variable pageId the correct value of your currentPage?
Best,
Sören
Hi Sören,
I'm pretty sure the pageID is correct, as despite the error message everything works as it should, the correct pages get published and the correct page gets moved under those newly created pages.
In my last test, the monthId was 1489 and the content, was what I expected it to be.
I can't debug it locally, so I'm afraid I can't tell you exactly what the values are.
Many Thanks
Paul
Hi Paul,
thanks, but without the possibility to debug this it's hard to find out the issue.At least I have currently no idea, sorry.
Best,
Sören
Hi Sören,
No worries and thank you for you help thus far. Hopefully someone will provide the answer I'm looking for.
Cheers
Paul
Ok, I've managed to solve this one.
I added the Refresh Content command, before and after and then I changed the event handle to:-
Originally I had this set to:-
I'm having this issue when I preview content on my umbraco 7.2.8 site.
So far, republishing the entire site and hard publishing the home page (that I was previewing in this case) hasn't solved the problem. As far as I can tell, I am not able to preview any nodes right now.
Ah ha! It doesn't affect every node. It especially does not affect leaf nodes. It looks like umbraco is having trouble previewing a node when one of the node's descendants is having problems. I followed the trail of broken previews all the way down to a leaf blog post. It was unpublished, but there were mandatory fields on it that were not entered. It looks like umbraco gets upset when you manage to save a node without filling out the mandatory fields.
is working on a reply...