This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
using Microsoft.Extensions.Logging; | |
using PnP.Core.Auth; | |
using PnP.Core.Auth.Services.Builder.Configuration; | |
using PnP.Core.Services; | |
using PnP.Core.Services.Builder.Configuration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THIS IS NOT WORKING. It´s raising a Bad Request response, but it might be possible with more testing | |
# and setting more Headers required by the API. | |
# You can do the Update from Admin centre, and get the request is done by the Page using Browser dev tools | |
#FIRST do Connect-PnPOnline to your tenant admin URL... | |
$url = "https://tenant-admin.sharepoint.com/" | |
$endpoint = "https://tenant-admin.sharepoint.com/_api/SPOInternalUseOnly.TenantAdminSettings" | |
$webCtx = (Get-PnPWeb).Context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-PnPOnline -url $webUrl | |
$template = Load-PnPProvisioningTemplate -Path ".../template.xml" | |
$parser = New-Object OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.TokenParser($web, $template); | |
$template.CustomActions.SiteCustomActions | | |
Where-Object {$_.RegistrationId -ne $null} | | |
ForEach-Object {$_.RegistrationId = $parser.ParseString($_.RegistrationId)} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pnp:CustomAction Name="MY_CA" | |
Title="Detail Panel Command Bar" | |
RegistrationId="{listid:My List Title}" | |
RegistrationType="List" | |
Location="ClientSideExtension.ListViewCommandSet.CommandBar" | |
ClientSideComponentId="44aceb7e-aaaa-bbbb-cccc-732a3422747c" | |
ClientSideComponentProperties="......" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EFADALTokenCache : TokenCache | |
{ | |
private ApplicationDbContext db = new ApplicationDbContext(); | |
private string user; | |
private PerWebUserCache cache; | |
// constructor | |
public EFADALTokenCache(string user) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Web web = parentWeb.Webs.Add(newWeb); | |
context.ExecuteQueryRetry(); | |
Podemos añadir el siguiente snippet: | |
if (template.ExtensibilityHandlers.Any()) | |
{ | |
// Clone Context pointing to Sub Site (needed for calling custom Extensibility Providers from the pnp template passing the right ClientContext) | |
string newWeburl = web.EnsureProperty(w => w.Url); | |
ClientContext webClientContext = context.Clone(newWeburl); | |
web = webClientContext.Web; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (ClientContext context = PnPPartnerPackContextProvider.GetAppOnlyClientContext(parentSiteUrl)) | |
Web parentWeb = context.Web; | |
Web web = parentWeb.Webs.Add(newWeb); | |
web.ApplyProvisioningTemplate(template, ptai); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Provision( | |
ClientContext ctx, | |
ProvisioningTemplate template, | |
ProvisioningTemplateApplyingInformation applyingInformation, | |
TokenParser tokenParser, | |
PnPMonitoredScope scope, | |
string configurationData) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthenticationManager authManager = new AuthenticationManager(); | |
ClientContext context = | |
authManager.GetSharePointOnlineAuthenticatedContextTenant(url, user, password); | |
var pageName = string.Format("ModernNewsPage_{0}.aspx", DateTime.Now.ToString("yyyyMMdd_HHmmss")); | |
List pagesLibrary = context.Web.GetListByTitle("Site Pages"); | |
var pagesLibraryUrl = pagesLibrary.RootFolder.ServerRelativeUrl; | |
var newPageUrl = pagesLibraryUrl + "/" + pageName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// execute after TypeScript task | |
build.rig.addPostTypescriptTask(helloWorldTask); | |
//execute before TypeScript task | |
build.rig.addBuildTasks(helloWorldTask); | |
//execute after all tasks | |
build.rig.addPostBuildTask(helloWorldTask); | |
//execute before all tasks |