Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioning Publishing Pages throws exception #795

Closed
leolorenzoluis opened this issue Feb 24, 2016 · 1 comment
Closed

Provisioning Publishing Pages throws exception #795

leolorenzoluis opened this issue Feb 24, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@leolorenzoluis
Copy link

Using latest version of M2 and running on SharePoint 2010 and document library requires content approval.

Given the following code

var aboutPublishing = new PublishingPageDefinition
    {
        Title = "About publishing",
        FileName = "About-publishing.aspx",
        PageLayoutFileName = BuiltInPublishingPageLayoutNames.ArticleLeft
    };

    var howToPublising = new PublishingPageDefinition
    {
        Title = "How to publish",
        FileName = "How-to-publish.aspx",
        PageLayoutFileName = BuiltInPublishingPageLayoutNames.ArticleRight
    };

    var publishingLinks = new PublishingPageDefinition
    {
        Title = "Publishing links",
        FileName = "Publishing-links.aspx",
        PageLayoutFileName = BuiltInPublishingPageLayoutNames.ArticleLinks
    };

    var model = SPMeta2Model.NewWebModel(web =>
    {
        web.AddHostList(BuiltInListDefinitions.Pages, list =>
        {
            list
                .AddPublishingPage(aboutPublishing)
                .AddPublishingPage(howToPublising)
                .AddPublishingPage(publishingLinks);
        });
    });

It throws

SPMeta2.Exceptions.SPMeta2ModelDeploymentException: There was an error while pro
visioning definition. Check ModelNode prop. ---> Microsoft.SharePoint.SPExceptio
n: The file "http://sp2010dev1/Pages/About-publishing.aspx" is checked out for e
diting by SHAREPOINT\system. ---> System.Runtime.InteropServices.COMException (0
x81020036): 0x81020036The file "
http://sp2010dev1/Pages/About-publishing.aspx" is checked out for editing by SHA
REPOINT\system.
at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String
bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPre
serveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int3
2& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bst
rVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& p
varProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean
bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback,
ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueField
Callback)
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, Str
ing bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVers
ion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, Stri
ng& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Obj
ect& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties
, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, Str
ing bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArr
ayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
--- End of inner exception stack trace ---
at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, Str
ing bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVers
ion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, Stri
ng& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Obj
ect& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties
, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, Str
ing bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArr
ayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSys
tem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boole
an bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID
, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAft
erEvents, String filename, Boolean bPreserveItemUIVersion)
at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bP
reserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boo
lean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvent
s, String filename, Boolean bPreserveItemUIVersion)
at Microsoft.SharePoint.SPListItem.SystemUpdate()
at SPMeta2.SSOM.Standard.ModelHandlers.PublishingPageModelHandler.<>c__Displa
yClass8.b__7(SPFile afterFile)
at SPMeta2.SSOM.ModelHandlers.ModuleFileModelHandler.WithSafeFileOperation(SP
List list, SPFolder folder, String fileUrl, String fileName, Byte[] fileContent,
Boolean overide, Action1 onBeforeAction, Action1 onAction)
at SPMeta2.SSOM.Standard.ModelHandlers.PublishingPageModelHandler.DeployPubli
shingPage(Object modelHost, SPList list, SPFolder folder, PublishingPageDefiniti
on publishingPageModel)
at SPMeta2.SSOM.Standard.ModelHandlers.PublishingPageModelHandler.DeployModel
(Object modelHost, DefinitionBase model)
at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.Traverse(Object mode
lHost, ModelNode modelNode)
--- End of inner exception stack trace ---
at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.Traverse(Object mode
lHost, ModelNode modelNode)
at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.<>c__DisplayClass6.<
Traverse>b__4(Object childModelHost)
at SPMeta2.SSOM.ModelHandlers.ListModelHandler.WithResolvingModelHost(ModelHo
stResolveContext modelHostContext)
at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.Traverse(Object mode
lHost, ModelNode modelNode)
at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.<>c__DisplayClass6.<
Traverse>b__4(Object childModelHost)
at SPMeta2.SSOM.ModelHandlers.WebModelHandler.WithResolvingModelHost(ModelHos
tResolveContext modelHostContext)
at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.Traverse(Object mode
lHost, ModelNode modelNode)
at SPMeta2.Services.ModelServiceBase.ProcessModelDeployment(Object modelHost,
ModelNode modelNode)
at SPMeta2.Services.ModelServiceBase.DeployModel(ModelHostBase modelHost, Mod
elNode model)
at SPMeta2.SSOM.Services.SSOMProvisionService.DeployModel(ModelHostBase model
Host, ModelNode model)
at SPMeta2.SSOM.Services.SSOMProvisionServiceExtensions.DeployWebModel(SSOMPr
ovisionService modelHost, SPWeb web, ModelNode model)

It gets approved the second time you run but only the first item. You have to keep rerunning in order to get it approved for everything.

@SubPointSupport
Copy link
Contributor

Seems to be a generic case for module file provision.
Closing with a new one - Add regression tests for file provision on library requires content approval #843 #843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants