Copying a document and it's children

Pablo Alejo asked on December 22, 2014 19:35

I get the following error when trying to update a document that I just copied...

[DataConnection.HandleError]: Query: Proc_CMS_Document_UpdateDocumentNamePath Caused exception: Procedure or function 'Proc_CMS_Document_UpdateDocumentNamePath' expects parameter '@GenerateAliases', which was not supplied.

The code I have is as follows.

TreeProvider treeProvider = new TreeProvider(user);
            TreeNode sourceNode = treeProvider.SelectSingleNode(SiteContext.CurrentSiteName, eventInfo.TemplateSourcePath, culture, false, null, false, true);
            TreeNode targetNode = treeProvider.SelectSingleNode(SiteContext.CurrentSiteName, eventInfo.TemplateTargetPath, culture, false, null, false, true);

            if (sourceNode != null && targetNode != null)
            {
                TreeNode conferenceDisplayName = DocumentHelper.CopyDocument(sourceNode, targetNode.NodeID, true, treeProvider, user.UserID);
                conferenceDisplayName.DocumentName = eventInfo.DisplayName;
                conferenceDisplayName.NodeAlias = eventInfo.CodeName;
                conferenceDisplayName.NodeName = eventInfo.DisplayName;
                conferenceDisplayName.SetDocumentNameSource(eventInfo.CodeName);

                bool enableDocumentAliases = treeProvider.EnableDocumentAliases;
                treeProvider.EnableDocumentAliases = false;
                DocumentHelper.UpdateDocument(conferenceDisplayName, treeProvider, "NodeName;NodeAlias;DocumentName");
                treeProvider.EnableDocumentAliases = enableDocumentAliases;

                if (conferenceDisplayName.PublishedVersionExists)
                {
                    VersionManager instance = VersionManager.GetInstance(treeProvider);
                    instance.WorkflowManager.MoveToPublishedStep(conferenceDisplayName, "Conference auto-publish");
                }
            }

Can anyone please help or let me know what I might be doing wrong? I'm using Kentico v8.0.14

Correct Answer

Timothy Fenton answered on December 22, 2014 20:10

Hello Alex!

Have you recently hotfixed / updated your Kentico instance? If so could you verify that the DLL files from the hotfix were brought over correctly that would be great. Seems like an out-of-date DLL file is referencing an old version of the stored procedure.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Pablo Alejo answered on December 22, 2014 20:05

Ok for now this fixed it...

TreeNode conferenceDisplayName = DocumentHelper.CopyDocument(sourceNode, targetNode.NodeID, true, treeProvider, user.UserID, 0, false, eventInfo.DisplayName);
                //conferenceDisplayName.DocumentName = eventInfo.DisplayName;
0 votesVote for this answer Mark as a Correct answer

Pablo Alejo answered on December 22, 2014 20:08

Cancel that, adding the document name to the copydocument method has given that name to the document and it's children

0 votesVote for this answer Mark as a Correct answer

Pablo Alejo answered on December 22, 2014 21:23

Looks like the dlls were old. Not sure why that happened but it definitely fixed the issue. Thanks again.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.