pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
416 stars 642 forks source link

CSOM ApplyProvisioningTemplate with parameters #1887

Open jmmartinez84 opened 6 years ago

jmmartinez84 commented 6 years ago

Hi there, I'm able to pass parameters to provisioning template using powershell script using -Parameters option Apply-PnPProvisioningTemplate -Web $web -Path $path -Parameters @{"xxx"=$xxx;"yyy"=$yyy;"zzz"=$zz;} But I don't kno how to do the same using CSOM newWeb.ApplyProvisioningTemplate(template, info);

thanks in advance

siata13 commented 5 years ago

Hi, I think that you can use 'Parameters' property directly in ProvisioningTemplate object: image

SpliceVW commented 4 years ago

I think that you can use 'Parameters' property directly in ProvisioningTemplate object:

The Parameters property is read-only on the ProvisioningTemplate object.

@jmmartinez84 did you ever find a solution? I am in a similar situation where I need to add parameters at runtime.

siata13 commented 4 years ago

@SpliceVW Yes, it is read-only (getter), but you can still use it to add your parameters: pnpTemplate.Parameters.Add(key,value);

SpliceVW commented 4 years ago

@siata13 doh! Thanks, worked like a charm.

Still, would probably nice to have a utility function when applying the template (similar to the PowerShell cmdlet) rather than having to manipulate the template.