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
var hostUrl = HttpUtility.ParseQueryString(Request.Url.Query).Get("SPHostUrl"); | |
Uri spHostUrl = new Uri(hostUrl); | |
using (var clientContext = TokenHelper.GetS2SClientContextWithWindowsIdentity(spHostUrl, Request.LogonUserIdentity)) | |
{ | |
} |
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
protected void Page_Load(object sender, EventArgs e) | |
{ | |
// The following code gets the client context and Title property by using TokenHelper. | |
// To access other properties, the app may need to request permissions on the host web. | |
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context); | |
using (var clientContext = spContext.CreateUserClientContextForSPHost()) | |
{ | |
clientContext.Load(clientContext.Web, web => web.Title); | |
clientContext.ExecuteQuery(); |
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
#region Variables | |
$siteUrl = "http://sharepoint2013/organization/Nav_Rep_WithoutVariation_De" | |
$featureID = [GUID]("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") | |
#endregion | |
#region Add references to SharePoint client assemblies - required for CSOM | |
Add-Type -Path "Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "Microsoft.SharePoint.Client.Runtime.dll" | |
#endregion |
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
#region Variables | |
$siteUrl = "http://sharepoint2013/organization/Nav_Rep_WithoutVariation_De" | |
$featureID = [GUID]("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") | |
#endregion | |
#region Add references to SharePoint client assemblies - required for CSOM | |
Add-Type -Path "Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "Microsoft.SharePoint.Client.Runtime.dll" | |
#endregion |
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
<%-- The following 4 lines are ASP.NET directives needed when using SharePoint components --%> | |
<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %> | |
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> | |
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> | |
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> | |
<%-- The markup and script in the following Content element will be placed in the <head> of the page --%> | |
<asp:Content ContentPlaceHolderID="PlaceHolderAdditi |
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
var React = require('react'); | |
var ReactDOM = require('react-dom'); | |
var Display = React.createClass({ | |
render: function () { | |
return(<h1>That's cool!</h1>) | |
} | |
}); | |
module.exports = Display; |
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
var React = require('react'); | |
var ReactDOM = require('react-dom'); | |
var Displ = require('./components/Display.react.jsx'); | |
ReactDOM.render( | |
<Display />, | |
document.getElementById('message') | |
); |
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
function Clear-PermissionsInProvisioningTemplate{ | |
$template = Load-PnPProvisioningTemplate -Path $provisioningTemplateFilePath | |
$template.Security.AdditionalAdministrators.Clear() | |
$template.Security.AdditionalMembers.Clear() | |
$template.Security.AdditionalOwners.Clear() | |
$template.Security.AdditionalVisitors.Clear() | |
Save-PnPProvisioningTemplate -Out $rootsiteTemplateFileName -InputInstance $template -Force | |
} |
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
function Get-ScriptFiles{ | |
#get all files | |
$query ="<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='FSObjType' /><Value Type='Integer'>0</Value></Eq></Where></Query><ViewFields><FieldRef Name='FileLeafRef' /><FieldRef Name='FileDirRef' /></ViewFields></View>" | |
$listItems = Get-PnPListItem -List $librarySiteAssets -Query $query | |
$libraryFolderPath = $librarySiteAssets + $scriptFolder | |
$folderPath = $PSScriptRoot + "\" + $folderFiles | |
foreach($listItem in $listItems){ | |
#get all items in the folder 'Scripts' | |
if($listItem.FieldValues.FileDirRef -match $scriptFolder){ |
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
function Get-WebParts($fileName){ | |
$pageFile = $librarySitePages + "/" + $fileName | |
$web = Get-PnPWeb | |
$serverRelativePageUrl = $web.ServerRelativeUrl + $pageFile | |
$serverRelativePageUrl | |
#Get all web parts | |
$webParts = Get-PnPWebPart -ServerRelativePageUrl $serverRelativePageUrl | |
$count = 0 |