ApplyProvisioningTemplate not working with app based certificate authentication using C#

Open
#837 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
backend

Research direction

Start with AuthenticationManager.GetContext and web.ApplyProvisioningTemplate using the certificate-based setup shown. Trace the ClientContextSettings cast between PnP.Framework.Utilities.Context and OfficeDevPnP.Core.Utilities.Context, then reproduce the XML template flow with XMLFileSystemTemplateProvider. Done when app-only certificate authentication applies the template without the cast error.

Written by the indexing model from the issue text.

Description

We are trying to apply pnp provisioning template using pnp.framework app only based authentication. As per the documentation, this can be only achieved using basic authentication using username and password.

code

PnP.Framework.AuthenticationManager("", cert, "", null, PnP.Framework.AzureEnvironment.Production, null).GetContext("");
XMLTemplateProvider sitesProvider = new XMLFileSystemTemplateProvider("", "");
ProvisioningTemplate template = sitesProvider.GetTemplate("");
web.ApplyProvisioningTemplate(template);

Error:

Unable to cast object of type 'PnP.Framework.Utilities.Context.ClientContextSettings' to type 'OfficeDevPnP.Core.Utilities.Context.ClientContextSettings'.

Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pnp/pnpframework

All issues in pnp/pnpframework

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.