Hello fellow sharepointers !

I need your help on my provisioning template.

I am creating a new Document library which is bound to a custom content Type. I want to add a whole architecture of folders and unfortunately can't make it work, i don't know why.

What i have :

my XML Template : GED_SiteLibrariesCreation.xml

<?xml version="1.0" encoding="utf-8" ?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2015/12/ProvisioningSchema">
    <pnp:ProvisioningTemplate ID="GED_SiteLibrariesCreation">
          <pnp:ListInstance Title="Documents projet"
                          Description="Documents partagées entre les acteurs du projet (ASI et client)"
              <pnp:ContentTypeBinding ContentTypeID="0x010100BBD2E6E36069334ABFD4717B8C2FA4D9" Default="true" />
              <pnp:ContentTypeBinding ContentTypeID="0x010100BBD2E6E36069334ABFD4717B8C2FA4D901"/>
              <pnp:ContentTypeBinding ContentTypeID="0x010100BBD2E6E36069334ABFD4717B8C2FA4D902"/>
              <pnp:FieldDefault FieldName="EtatValidation">Brouillon</pnp:FieldDefault>
              <pnp:FieldDefault FieldName="EtatValidationCR">A valider</pnp:FieldDefault>

              <pnp:Folder Name="01.TEST">
                  <pnp:Folder Name="0102. TEST"></pnp:Folder>


What do i get :

My list is created or updated, but no folder are created. I have absolutely no error nor output saying something went wrong.

I've followed letter to letter the examples given in the provisioning schema on GitHub

Please, could you give me other examples or a clue on what could go wrong ?

Thanks a lot.

Have a nice day.

  • <pnp:Folder Name="0102. TEST"></pnp:Folder> instead of this, try it as <pnp:Folder Name="0102. TEST"/> Nov 21, 2016 at 16:59
  • Hello @GautamSheth, thanks for your reply. I've tested as you said and it is still not working... Thanks for your time anyway, i hope it could help someone else ;)
    – Gaelle
    Nov 28, 2016 at 13:38

1 Answer 1


I've tried your template and everything works fine for me - folders are created (I deleted ContentTypeBindings since this content types don't exist in my environment).

I can recommend the following:

  1. Make sure you are using latest version of PnP from nuget (I'm using SharePointPnPCoreOnline.2.9.1611.0)

  2. If #1 didn't help, try to remove all ContentTypeBindings like I did (may be that's an issue?)

So finally, thanks to @Gaelle comment, I was able to reproduce this behavior.
I found that there is a bug in PnP - here is the link to corresponding issue reported October, 20.
Following code will not work for you:

var ctx = new ClientContext("https://sp.sharepoint.com/sites/dev/");
var subweb = ctx.Site.OpenWeb("tests");

Besides this one works:

var ctx = new ClientContext("https://sp.sharepoint.com/sites/dev/tests");

And this is what is the issue about: in the first sample I'm using OpenWeb method and it doesn't work, for second sample I created client context using sub site url and it does work.

For now I think this is the only working workaround for you - construct new client context (don't forget about disposing) for subsite.

  • Hello @Kai, thanks for your comment. Normally my version of SharepointPnpCoreOnline is the good one. But because we are working on Azure, i will check if the packages are good on it. Removing ContentTypeBindings did not work, and it won't be a real solution but only a workaround since we really need custom ContentType to be bound in our Doc Libraries... i'll give a feedback later.
    – Gaelle
    Nov 28, 2016 at 13:39
  • Hello @Kai I have a request for you : did you test my xml template on a ROOT site or on a WEB site ? (this could really be important). Because we are creating and provisioning this library into a subsite (or website) under or site collection... Thanks a lot for your feedback !
    – Gaelle
    Nov 28, 2016 at 16:43
  • @Gaelle: now I see... please take a look at my update Nov 28, 2016 at 17:46
  • THANKS A LOT ! Effectively, rebuilding client context with subweb URL is the solution ! We managed it. And well, i think maybe it is a better practice to reload the right context
    – Gaelle
    Nov 29, 2016 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.