I've got a .NET core application that run fine from a command prompt that creates SharePoint Sites and adds content types from templates. When I schedule it to run via Windows Scheduled Tasks with the same account it fails with the following error:

Error applying client template: The Provisioning Template URI "MyTemplate.xml" is not valid.

The "client template" is the site collection template

What would cause it to not run properly when scheduled?

  • Is this office 365 or on premise?
    – Andrew
    Commented Nov 15, 2018 at 14:26
  • @Andrew Office 365 I believe as I'm still getting up to speed on all things SharePoint. The URL is CompanyName.SharePoint.com/bla/bla/bla
    – RichP
    Commented Nov 15, 2018 at 15:02

2 Answers 2


It's not finding the file because the scheduled task is not looking in the folder you expect it to.

  • Derek, are you saying it is all related to Scheduled Tasks and not SharePoint? If so can you elaborate? The custom templates for site creation are in a sub directory relative to where the .exe is located
    – RichP
    Commented Nov 15, 2018 at 20:54
  • 1
    Derek Set me on the right path. Check out this SO post to set directory/.folder stackoverflow.com/questions/21476149/…
    – RichP
    Commented Nov 16, 2018 at 17:13

You may want to check out this link: How to get list of available custom template name using powershell script

If the template you are using is not one of the templates that are used by default it may cause some issues when calling on the template.

I use pnp PowerShell tools to find info about the available templates and their names. Hope this helps.

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.