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
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" | |
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Publishing.dll" | |
# Authenticate with the SharePoint site. | |
# | |
$siteUrl = Read-Host -Prompt "Enter site url" | |
$username = Read-Host -Prompt "Enter Username" | |
$password = Read-Host -Prompt "Enter password" -AsSecureString | |
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) |
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
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" | |
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Publishing.dll" | |
# Authenticate with the SharePoint site. | |
# | |
$siteUrl = Read-Host -Prompt "Enter web url:" | |
$username = Read-Host -Prompt "Enter Username:" | |
$password = Read-Host -Prompt "Enter password" -AsSecureString | |
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) |
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
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" | |
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Publishing.dll" | |
# Authenticate with the SharePoint site. | |
# | |
$siteUrl = Read-Host -Prompt "Enter web url:" | |
$username = Read-Host -Prompt "Enter Username:" | |
$password = Read-Host -Prompt "Enter password" -AsSecureString | |
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) |
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
$rootWeb = $ctx.Web | |
$ctx.Load($rootWeb) | |
$caColl = $rootWeb.get_userCustomActions() | |
$ctx.Load($caColl) | |
$ctx.ExecuteQuery() | |
$caColl | ForEach-Object { | |
if ($_.title -eq 'Invoke GetItemsCount Action') { | |
$_.DeleteObject() | |
Write-Host 'Existing item deleted.' |
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
$cUIExtn = "<CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=""Ribbon.List.Share.Controls._children""> | |
<Button Id=""Ribbon.List.Share.GetItemsCountButton"" Alt=""Get list items count"" Sequence=""11"" Command=""Invoke_GetItemsCountButtonRequest"" LabelText=""Get Items Count"" TemplateAlias=""o1"" Image32by32=""_layouts/15/images/placeholder32x32.png"" Image16by16=""_layouts/15/images/placeholder16x16.png"" /> | |
</CommandUIDefinition></CommandUIDefinitions><CommandUIHandlers> | |
<CommandUIHandler Command=""Invoke_GetItemsCountButtonRequest"" CommandAction=""javascript: alert('Total items in this list: '+ ctx.TotalListItems);"" | |
EnabledScript=""javascript: function checkEnable() { return (true);} checkEnable();""/></CommandUIHandlers></CommandUIExtension>" | |
$newUCA = $caColl.Add() | |
$newUCA.set_registrationId("100"); | |
$newUCA.set_registrationType("List"); | |
$newUCA.set_location('CommandUI.Ribbon'); |
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-SPOnline –Url https://yoursite.sharepoint.com –Credentials (Get-Credential) | |
$cUIExtn = "<CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=""Ribbon.List.Share.Controls._children""><Button Id=""Ribbon.List.Share.GetItemsCountButton"" Alt=""Get list items count"" Sequence=""11"" Command=""Invoke_GetItemsCountButtonRequest"" LabelText=""Get Items Count"" TemplateAlias=""o1"" Image32by32=""_layouts/15/images/placeholder32x32.png"" Image16by16=""_layouts/15/images/placeholder16x16.png"" /></CommandUIDefinition></CommandUIDefinitions><CommandUIHandlers><CommandUIHandler Command=""Invoke_GetItemsCountButtonRequest"" CommandAction=""javascript: alert('Total items in this list: '+ ctx.TotalListItems);"" EnabledScript=""javascript: function checkEnable() { return (true);} checkEnable();""/></CommandUIHandlers></CommandUIExtension>" | |
Add-SPOCustomAction -Name 'ff1591d2-8613-4a1c-b465-d647a34b2555-GetItemsCount' -Title 'Invoke GetItemsCount Action' -Description 'Adds custom action to custom l |
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
{ | |
"tenant": "yourtenant.onmicrosoft.com", | |
"authorityHostUrl": "https://login.windows.net", | |
"clientId": "89bedb2a-3c1e-4df6-b544-8f1f14392ebd", | |
"clientSecret": "vM2XycJD8lf29qfckwGC604ATqUBYTFcIsxvdnZuNFo=", | |
"resource": "https://yourtenant.sharepoint.com" | |
} |
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
$mpList = $rootWeb.Lists.GetByTitle('Master Page Gallery') | |
$camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery | |
$camlQuery.ViewXml = '<View Scope="RecursiveAll"><Query><Where><Eq><FieldRef Name="FileLeafRef" /><Value Type="Text">YOURLAYOUT.aspx</Value></Eq></Where></Query></View>' | |
$items = $mpList.GetItems($camlQuery) | |
$ctx.Load($items) | |
$ctx.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
$pubPageInfo = New-Object Microsoft.SharePoint.Client.Publishing.PublishingPageInformation | |
$pubPageInfo.Name = $CSVitem.Name.Replace(" ", "-") + ".aspx" | |
$pubPageInfo.PageLayoutListItem = $tpLayoutItem | |
$pubPage = $pubWeb.AddPublishingpage($pubPageInfo) | |
$ctx.Load($pubPage) | |
$ctx.ExecuteQuery() | |
$listItem = $pubPage.get_listItem() | |
$ctx.Load($listItem) |
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
try{ | |
$itemCreateInfo = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation | |
$listItem = $list.addItem($itemCreateInfo) | |
$daten = Get-Date | |
$listItem.set_item('Title',$daten) | |
$listItem.update() | |
$ctx.Load($listItem) | |
$ctx.ExecuteQuery() | |
Write-Output "Item successfully created." | |
} |