From ff1ab75eb4fe6437ad91aadc884cff705f582213 Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Thu, 30 Jan 2020 17:21:14 +0100
Subject: [PATCH 01/37] Update description.md
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Pojawił się mały problem z czerwonym podświetleniem tekstu. Kod html nie chciał tego zamienić tak żeby wyglądało jak w technet, znalazłem takie rozwiązanie. Spróbować znaleźć inne, czy takie wystarczy?
---
.../description.md | 28 +++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/Content Types/Create/Add existing content type directly to SPO list/description.md b/Content Types/Create/Add existing content type directly to SPO list/description.md
index f318e934..86ced017 100644
--- a/Content Types/Create/Add existing content type directly to SPO list/description.md
+++ b/Content Types/Create/Add existing content type directly to SPO list/description.md
@@ -2,16 +2,14 @@ A short script to add an existing site content type directly to a SharePoint Onl
-The script is fully described in an article here:
-
-http://social.technet.microsoft.com/wiki/contents/articles/31051.sharepoint-online-content-types-in-powershell.aspx
+The script is fully described in an article [here](http://social.technet.microsoft.com/wiki/contents/articles/31051.sharepoint-online-content-types-in-powershell.aspx).
### How to use?
-1. Download and install SharePoint Online SDK.
+1. Download and install [SharePoint Online SDK](https://www.microsoft.com/en-us/download/details.aspx?id=42038).
-2. Download the .ps1 file.
+2. Download the *.ps1* file.
3. Open the file (you can do it also in NotePad)
@@ -35,21 +33,23 @@ $ContentTypeID="0x01200200C44754774BD8D4449F4B7E3FE70A7E0E"
d) Enter the title of the list.
e) Enter the content type id
-###### How to find the content type id?
-* via browser
-Go to Site>Gear Icon>Site Settings>Content Types>Click on the content type. The url at this point should look like this:
-https://tenant.sharepoint.com/sites/TeamsitewithLists/_layouts/15/ManageContentType.aspx?ctype=0x0100A02B0ABDDEDC5A45AC64F100F30899CF&Source=https%3A%2F%2Ftenant%2Esharepoint%2Ecom%2Fsites%2FTeamsitewithLists%2F%5Flayouts%2F15%2Fmngctype%2Easpx
+##### *How to find the content type id?*
+* via browser
+Go to **Site**>**Gear Icon**>**Site Settings**>**Content Types**>**Click on the content type**. The url at this point should look like **[this](https://tenant.sharepoint.com/sites/TeamsitewithLists/_layouts/15/ManageContentType.aspx?ctype=0x0100A02B0ABDDEDC5A45AC64F100F30899CF&Source=https%3A%2F%2Ftenant%2Esharepoint%2Ecom%2Fsites%2FTeamsitewithLists%2F%5Flayouts%2F15%2Fmngctype%2Easpx)**.
+```diff
+https://tenant.sharepoint.com/sites/TeamsitewithLists/_layouts/15/ManageContentType.aspx?ctype=
+- 0x0100A02B0ABDDEDC5A45AC64F100F30899CF
+&Source=https%3A%2F%2Ftenant%2Esharepoint%2Ecom%2Fsites%2FTeamsitewithLists%2F%5Flayouts%2F15%2Fmngctype%2Easpx
+```
Marked in red is the content type id.
-* via another script
-Get all properties of all content types in a SharePoint site
-
+* via another script
+[Get all properties of all content types in a SharePoint site](https://gallery.technet.microsoft.com/Get-all-properties-of-all-3a9c5c4b)
5. Run the script in Powershell (any module).
-6. When the script has executed, Powershell will show a message Content Type Name of the Content Type2 has been added to Url of the Site.
+6. When the script has executed, Powershell will show a message *Content Type Name of the Content Type2 has been added to Url of the Site*.
-
Enjoy and please share feedback!
From be621d1547bb1fc78159ca547af1b31adbe1ef98 Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Thu, 30 Jan 2020 17:25:22 +0100
Subject: [PATCH 02/37] Update AddExistingContentTypetoOneList.ps1
---
.../AddExistingContentTypetoOneList.ps1 | 71 +++++++++----------
1 file changed, 32 insertions(+), 39 deletions(-)
diff --git a/Content Types/Create/Add existing content type directly to SPO list/AddExistingContentTypetoOneList.ps1 b/Content Types/Create/Add existing content type directly to SPO list/AddExistingContentTypetoOneList.ps1
index 43825fba..b03c128d 100644
--- a/Content Types/Create/Add existing content type directly to SPO list/AddExistingContentTypetoOneList.ps1
+++ b/Content Types/Create/Add existing content type directly to SPO list/AddExistingContentTypetoOneList.ps1
@@ -1,47 +1,40 @@
-function Add-SPOContentType
-{
-param(
-[Parameter(Mandatory=$true,Position=1)]
+function Add-SPOContentType{
+ param(
+ [Parameter(Mandatory=$true,Position=1)]
[string]$Username,
- [Parameter(Mandatory=$true,Position=2)]
+ [Parameter(Mandatory=$true,Position=2)]
$AdminPassword,
- [Parameter(Mandatory=$true,Position=3)]
+ [Parameter(Mandatory=$true,Position=3)]
[string]$Url,
- [Parameter(Mandatory=$true,Position=4)]
+ [Parameter(Mandatory=$true,Position=4)]
[string]$ListTitle,
- [Parameter(Mandatory=$true,Position=7)]
+ [Parameter(Mandatory=$true,Position=7)]
[string]$ContentTypeID
- )
-
- $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
- $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
- $ctx.Load($ctx.Web.Lists)
- $ctx.ExecuteQuery()
-
- $contentType=$ctx.Web.ContentTypes.GetById($ContentTypeID)
- $ctx.Load($contentType)
-
- $ll=$ctx.Web.Lists.GetByTitle($ListTitle)
- $ctx.load($ll)
- $ctx.load($ll.ContentTypes)
- $ctx.ExecuteQuery()
- $ll.ContentTypesEnabled=$true
- $AddedContentType=$ll.ContentTypes.AddExistingContentType($contentType)
- $ll.Update()
-
- try
- {
-
- $ctx.ExecuteQuery()
- Write-Host "Adding content type " $AddedContentType.Name " to " $ll.Title
- }
- catch [Net.WebException]
- {
- Write-Host $_.Exception.ToString()
- }
-
-
-
+ )
+
+ $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
+ $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
+ $ctx.Load($ctx.Web.Lists)
+ $ctx.ExecuteQuery()
+
+ $contentType=$ctx.Web.ContentTypes.GetById($ContentTypeID)
+ $ctx.Load($contentType)
+
+ $ll=$ctx.Web.Lists.GetByTitle($ListTitle)
+ $ctx.load($ll)
+ $ctx.load($ll.ContentTypes)
+ $ctx.ExecuteQuery()
+ $ll.ContentTypesEnabled=$true
+ $AddedContentType=$ll.ContentTypes.AddExistingContentType($contentType)
+ $ll.Update()
+
+ try{
+ $ctx.ExecuteQuery()
+ Write-Host "Adding content type " $AddedContentType.Name " to " $ll.Title
+ }
+ catch [Net.WebException]{
+ Write-Host $_.Exception.ToString()
+ }
}
From 5a6263609fdf8c4353fe8ebf738069b26fffe8fd Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Thu, 30 Jan 2020 19:17:38 +0100
Subject: [PATCH 03/37] Update ModifyDisplayFormTemplateName-ContentTypeHub.ps1
---
...DisplayFormTemplateName-ContentTypeHub.ps1 | 37 +++++++------------
1 file changed, 13 insertions(+), 24 deletions(-)
diff --git a/Content Types/Get/All Content Types from a Content Type Hub and their DisplayFormTemplate/ModifyDisplayFormTemplateName-ContentTypeHub.ps1 b/Content Types/Get/All Content Types from a Content Type Hub and their DisplayFormTemplate/ModifyDisplayFormTemplateName-ContentTypeHub.ps1
index 91519a06..c16944a8 100644
--- a/Content Types/Get/All Content Types from a Content Type Hub and their DisplayFormTemplate/ModifyDisplayFormTemplateName-ContentTypeHub.ps1
+++ b/Content Types/Get/All Content Types from a Content Type Hub and their DisplayFormTemplate/ModifyDisplayFormTemplateName-ContentTypeHub.ps1
@@ -1,16 +1,14 @@
-function Set-SPOContentType
-{
-
- param (
- [Parameter(Mandatory=$true,Position=1)]
- [string]$Username,
- [Parameter(Mandatory=$true,Position=2)]
- $AdminPassword,
- [Parameter(Mandatory=$true,Position=3)]
- [string]$Url
- )
+function Set-SPOContentType{
+param (
+ [Parameter(Mandatory=$true,Position=1)]
+ [string]$Username,
+ [Parameter(Mandatory=$true,Position=2)]
+ $AdminPassword,
+ [Parameter(Mandatory=$true,Position=3)]
+ string]$Url
+)
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
@@ -18,21 +16,12 @@ function Set-SPOContentType
$ctx.ExecuteQuery()
- foreach($cc in $ctx.Web.ContentTypes)
- {
-
- Write-Host $cc.Name " " $cc.DisplayFormTemplateName
-
-
-
+foreach($cc in $ctx.Web.ContentTypes){
+ Write-Host $cc.Name " " $cc.DisplayFormTemplateName
}
-
-
- $ctx.Dispose()
-
-
- }
+ $ctx.Dispose()
+}
From cd521ba49399c3e7e04846e41f9d2d3ee127c9d2 Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Thu, 30 Jan 2020 19:23:44 +0100
Subject: [PATCH 04/37] Update CompareAvVSCT.ps1
---
.../CompareAvVSCT.ps1 | 92 ++++++++-----------
1 file changed, 36 insertions(+), 56 deletions(-)
diff --git a/Content Types/Get/Compare Web.AvailableContentTypes vs Web.ContentTypes/CompareAvVSCT.ps1 b/Content Types/Get/Compare Web.AvailableContentTypes vs Web.ContentTypes/CompareAvVSCT.ps1
index e516ffa6..17c036f1 100644
--- a/Content Types/Get/Compare Web.AvailableContentTypes vs Web.ContentTypes/CompareAvVSCT.ps1
+++ b/Content Types/Get/Compare Web.AvailableContentTypes vs Web.ContentTypes/CompareAvVSCT.ps1
@@ -1,64 +1,44 @@
-function Get-SPOContentType
-{
-
- param (
- [Parameter(Mandatory=$true,Position=1)]
+function Get-SPOContentType{
+ param (
+ [Parameter(Mandatory=$true,Position=1)]
[string]$Username,
[Parameter(Mandatory=$true,Position=2)]
$AdminPassword,
- [Parameter(Mandatory=$true,Position=3)]
+ [Parameter(Mandatory=$true,Position=3)]
[string]$Url
- )
-
- $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
- $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
- $ctx.ExecuteQuery()
-
- $ctx.Load($ctx.Web)
- $ctx.Load($ctx.Web.AvailableContentTypes)
- $ctx.ExecuteQuery()
- Write-Host
-# Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
- $i=0
- foreach( $cc in $ctx.Web.AvailableContentTypes)
- {
-
- $i++
-
- }
- Write-Host "Available content types " $i
-
- $ctx.Load($ctx.Web.ContentTypes)
- $ctx.ExecuteQuery()
- Write-Host
- # Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
- $i=0
- foreach( $cc in $ctx.Web.ContentTypes)
- {
-
- $i++
-
- }
- Write-Host "Content types in this site " $i
-
-
-
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
+ )
+
+ $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
+ $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
+ $ctx.ExecuteQuery()
+
+ $ctx.Load($ctx.Web)
+ $ctx.Load($ctx.Web.AvailableContentTypes)
+ $ctx.ExecuteQuery()
+ Write-Host
+ # Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
+ $i=0
+
+ foreach( $cc in $ctx.Web.AvailableContentTypes){
+ $i++
+ }
+
+ Write-Host "Available content types " $i
+
+ $ctx.Load($ctx.Web.ContentTypes)
+ $ctx.ExecuteQuery()
+ Write-Host
+ # Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
+ $i=0
+
+ foreach( $cc in $ctx.Web.ContentTypes){
+ $i++
+ }
+
+ Write-Host "Content types in this site " $i
+}
@@ -73,4 +53,4 @@ $AdminUrl="https://tenant.sharepoint.com/sites/teamsitewithlibraries/subsite"
-Get-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl
\ No newline at end of file
+Get-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl
From 93c0f4ab90e5b1ef0c926381d2fcb4b6dcd19e06 Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Thu, 30 Jan 2020 22:48:40 +0100
Subject: [PATCH 05/37] Update GetSingleContentTypeLoop.ps1
---
.../GetSingleContentTypeLoop.ps1 | 58 +++++++------------
1 file changed, 21 insertions(+), 37 deletions(-)
diff --git a/Content Types/Get/Get All Hidden Content Types added to the site/GetSingleContentTypeLoop.ps1 b/Content Types/Get/Get All Hidden Content Types added to the site/GetSingleContentTypeLoop.ps1
index 91865e71..e9a3e086 100644
--- a/Content Types/Get/Get All Hidden Content Types added to the site/GetSingleContentTypeLoop.ps1
+++ b/Content Types/Get/Get All Hidden Content Types added to the site/GetSingleContentTypeLoop.ps1
@@ -1,48 +1,32 @@
-function Get-SPOContentType
-{
-
- param (
- [Parameter(Mandatory=$true,Position=1)]
+function Get-SPOContentType{
+ param (
+ [Parameter(Mandatory=$true,Position=1)]
[string]$Username,
[Parameter(Mandatory=$true,Position=2)]
$AdminPassword,
- [Parameter(Mandatory=$true,Position=3)]
+ [Parameter(Mandatory=$true,Position=3)]
[string]$Url
- )
-
- $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
- $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
- $ctx.ExecuteQuery()
-
- $ctx.Load($ctx.Web)
-
- $ctx.Load($ctx.Web.ContentTypes)
- $ctx.ExecuteQuery()
-
-
- foreach($cc in $ctx.Web.ContentTypes)
- {
- if($cc.Hidden -eq $true)
- {
- Write-Host $cc.Name
- }
- }
+ )
-
-
-
-
-
-
- }
-
+ $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
+ $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
+ $ctx.ExecuteQuery()
-
-
-
+ $ctx.Load($ctx.Web)
+ $ctx.Load($ctx.Web.ContentTypes)
+ $ctx.ExecuteQuery()
+
+
+ foreach($cc in $ctx.Web.ContentTypes){
+ if($cc.Hidden -eq $true){
+ Write-Host $cc.Name
+ }
+ }
+}
+
# Paths to SDK. Please verify location on your computer.
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
@@ -56,4 +40,4 @@ $AdminUrl="https://tenant.sharepoint.com/sites/teamsitewithlibraries"
-Get-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl
\ No newline at end of file
+Get-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl
From 43e208db2fa9372e75f0fb0535dbe2c1e6f7f6ed Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Fri, 28 Feb 2020 00:40:57 +0100
Subject: [PATCH 06/37] Update description.md
---
.../description.md | 43 ++++---------------
1 file changed, 9 insertions(+), 34 deletions(-)
diff --git a/Items Management/Bulk update all items in a list/description.md b/Items Management/Bulk update all items in a list/description.md
index 0396d756..2671eab5 100644
--- a/Items Management/Bulk update all items in a list/description.md
+++ b/Items Management/Bulk update all items in a list/description.md
@@ -1,41 +1,16 @@
Short Powershell script to bulk update all items in a list
-
-
-
+### **Example**
-
-
-Example
-
-
-
-
-
-
Result:
+
-
-
-
-
-
+## **Requirements**
-
-
-
-Requirements
-
-
-
Before running the script, you have to modify the last lines!
-
-
-
-
```PowerShell
# Paths to SDK. Please verify location on your computer.
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
@@ -45,18 +20,18 @@ Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extens
Update-SPOListItem -Username user@tenant.onmicrosoft.com -Url https://tenant.sharepoint.com/sites/teamsitewithlists -AdminPassword Pass -ListTitle "contacts list" -FieldToUpdate elp -ValueToUpdate bio
```
-Enter your credentials
-FieldToUpdate specifies the name of the list column which you want to update
-ValueToUpdate means the value that you want to enter in that column for each item
-Verify if the SharePoint Online SDK is installed in the same location on your computer
++ Enter your credentials
++ FieldToUpdate specifies the name of the list column which you want to update
++ ValueToUpdate means the value that you want to enter in that column for each item
++ Verify if the [SharePoint Online SDK](https://www.microsoft.com/en-us/download/details.aspx?id=42038) is installed in the same location on your computer
Related Scripts
-Powershell Module with Update-SPOListItem cmdlet
+[Powershell Module with Update-SPOListItem cmdlet](https://gallery.technet.microsoft.com/scriptcenter/Powershell-Module-for-easy-5d590623)
-Enjoy and please share feedback!
\ No newline at end of file
+Enjoy and please share feedback!
From 7e57412cb00c20d53e925ef54a4624005c1b368d Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Fri, 28 Feb 2020 00:43:02 +0100
Subject: [PATCH 07/37] Update BulkUpdate.ps1
---
.../BulkUpdate.ps1 | 56 ++++++++-----------
1 file changed, 24 insertions(+), 32 deletions(-)
diff --git a/Items Management/Bulk update all items in a list/BulkUpdate.ps1 b/Items Management/Bulk update all items in a list/BulkUpdate.ps1
index 03c51214..4e963d1c 100644
--- a/Items Management/Bulk update all items in a list/BulkUpdate.ps1
+++ b/Items Management/Bulk update all items in a list/BulkUpdate.ps1
@@ -1,20 +1,18 @@
- function Update-SPOListItem
-{
-
- param (
- [Parameter(Mandatory=$true,Position=1)]
- [string]$Username,
- [Parameter(Mandatory=$true,Position=2)]
- [string]$Url,
- [Parameter(Mandatory=$true,Position=3)]
- [string]$AdminPassword,
- [Parameter(Mandatory=$true,Position=4)]
- [string]$ListTitle,
-[Parameter(Mandatory=$true,Position=6)]
- [string]$FieldToUpdate,
-[Parameter(Mandatory=$true,Position=7)]
- [string]$ValueToUpdate
- )
+function Update-SPOListItem{
+ param (
+ [Parameter(Mandatory=$true,Position=1)]
+ [string]$Username,
+ [Parameter(Mandatory=$true,Position=2)]
+ [string]$Url,
+ [Parameter(Mandatory=$true,Position=3)]
+ [string]$AdminPassword,
+ [Parameter(Mandatory=$true,Position=4)]
+ [string]$ListTitle,
+ [Parameter(Mandatory=$true,Position=6)]
+ [string]$FieldToUpdate,
+ [Parameter(Mandatory=$true,Position=7)]
+ [string]$ValueToUpdate
+ )
@@ -39,30 +37,24 @@
$count=$itemki.Count
Write-Host $count
- foreach($item in $itemki)
- {
- $item[$FieldToUpdate]=$ValueToUpdate
+
+ foreach($item in $itemki){
+ $item[$FieldToUpdate]=$ValueToUpdate
$item.Update()
-
}
-
- try
- {
- $ctx.ExecuteQuery()
- write-host " Success"
+ try{
+ $ctx.ExecuteQuery()
+ write-host " Success"
}
- catch [Net.WebException]
- {
+ catch [Net.WebException]{
Write-Host $_.Exception.ToString() -ForegroundColor Red
- }
-
-
}
+}
# Paths to SDK. Please verify location on your computer.
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"
-Update-SPOListItem -Username user@domain.onmicrosoft.com -Url https://tenant.sharepoint.com/sites/teamsitewithlists -AdminPassword Pass -ListTitle "contacts list" -FieldToUpdate MyColumnName -ValueToUpdate SomeRandomValue
\ No newline at end of file
+Update-SPOListItem -Username user@domain.onmicrosoft.com -Url https://tenant.sharepoint.com/sites/teamsitewithlists -AdminPassword Pass -ListTitle "contacts list" -FieldToUpdate MyColumnName -ValueToUpdate SomeRandomValue
From 1f797819398af4cebd102caf4ab7f427e66eb3a6 Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Fri, 28 Feb 2020 00:44:30 +0100
Subject: [PATCH 08/37] Update description.md
---
.../description.md | 59 +++++++------------
1 file changed, 21 insertions(+), 38 deletions(-)
diff --git a/Items Management/Create new list item using Powershell/description.md b/Items Management/Create new list item using Powershell/description.md
index 7c09a3b6..f1a9692b 100644
--- a/Items Management/Create new list item using Powershell/description.md
+++ b/Items Management/Create new list item using Powershell/description.md
@@ -2,58 +2,47 @@ Powershell Module with one new cmdlet
-New-SPOListItem
+## **New-SPOListItem**
-
-
-Parameters
+### *Parameters*
The cmdlet is using the following parameters:
-
+```powershell
[string]$Username
+ ```
The string specifies admin of the site
-
+```powershell
[string]$Url
+```
Specifies the url of a site where you have the list
-
-[string]$AdminPassword,
+```powershell
+[string]$AdminPassword,
+```
Admin's password
-
+```powershell
[string]$ListTitle
+```
Specifies the title of the list where you want to change the settings.
-
+```powershell
[string]$ItemTitle
+```
Specifies the title of the list item. In case of a contact list it will be the LastName, task list -> task name, etc.
-
+```powershell
[string]$AdditionalField=""
+```
Optional. If you want to add some additional attribute to the item at the moment of creation. For more attributes use Update-SPOListItem. This parameter defines the internal name of the column
-
+```powershell
[string]$AdditionalValue=""
+```
Optional. If you want to add some additional attribute to the item at the moment of creation. For more attributes use Update-SPOListItem. This parameter defines the value that you want to input.
-
-
-
-
-Examples
-
-
-
-
-
-
-
-
-
-
-
-
+### *Examples*
-Requirements
+
-The following libraries (SharePoint Online SDK) are required. If those libraries are in different location on your computer, please edit the .psm1 file!
+### *Requirements*
-
+The following libraries (SharePoint Online SDK) are required. If those libraries are in different location on your computer, please edit the ```.psm1``` file!
```PowerShell
# Paths to SDK. Please verify location on your computer.
@@ -61,12 +50,6 @@ Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extens
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
```
-
-
-
-
-
-
Enjoy and please share feedback!
From 0e7c4f51669a95e55d6faec7709a46fdc7a56720 Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Fri, 28 Feb 2020 00:45:18 +0100
Subject: [PATCH 09/37] Update NewSPOListItem.psm1
---
.../NewSPOListItem.psm1 | 53 +++++++++----------
1 file changed, 24 insertions(+), 29 deletions(-)
diff --git a/Items Management/Create new list item using Powershell/NewSPOListItem.psm1 b/Items Management/Create new list item using Powershell/NewSPOListItem.psm1
index 8cf76cc3..fc64496c 100644
--- a/Items Management/Create new list item using Powershell/NewSPOListItem.psm1
+++ b/Items Management/Create new list item using Powershell/NewSPOListItem.psm1
@@ -1,23 +1,22 @@
-function New-SPOListItem
-{
-param (
+function New-SPOListItem{
+ param (
[Parameter(Mandatory=$true,Position=1)]
- [string]$Username,
- [Parameter(Mandatory=$true,Position=2)]
- [string]$Url,
+ [string]$Username,
+ [Parameter(Mandatory=$true,Position=2)]
+ [string]$Url,
[Parameter(Mandatory=$true,Position=3)]
- [string]$AdminPassword,
+ [string]$AdminPassword,
[Parameter(Mandatory=$true,Position=4)]
- [string]$ListTitle,
+ [string]$ListTitle,
[Parameter(Mandatory=$true,Position=5)]
- [string]$ItemTitle,
-[Parameter(Mandatory=$false,Position=6)]
- [string]$AdditionalField="",
-[Parameter(Mandatory=$false,Position=7)]
- [string]$AdditionalValue=""
- )
-
-$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force
+ [string]$ItemTitle,
+ [Parameter(Mandatory=$false,Position=6)]
+ [string]$AdditionalField="",
+ [Parameter(Mandatory=$false,Position=7)]
+ [string]$AdditionalValue=""
+ )
+
+ $password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password)
$ctx.Load($ctx.Web)
@@ -32,25 +31,21 @@ $password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force
$listItem = $ll.AddItem($lici)
$listItem["Title"]=$ItemTitle
- if($AdditionalField -ne "")
- {
+
+ if($AdditionalField -ne ""){
$listItem[$AdditionalField]=$AdditionalValue
}
+
$listItem.Update()
$ll.Update()
- try
- {
-
- $ctx.ExecuteQuery()
- Write-Host "Item " $ItemTitle " has been added to list " $ListTitle
- }
- catch [Net.WebException]
- {
+ try{
+ $ctx.ExecuteQuery()
+ Write-Host "Item " $ItemTitle " has been added to list " $ListTitle
+ }
+ catch [Net.WebException]{
Write-Host $_.Exception.ToString()
- }
-
-
+ }
}
From 6376a30a3d0424b66c3dddd524d8a242a0b5d22e Mon Sep 17 00:00:00 2001
From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com>
Date: Fri, 28 Feb 2020 00:46:51 +0100
Subject: [PATCH 10/37] Update description.md
---
.../description.md | 34 ++++++++-----------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/Items Management/Get the number of items in a list/description.md b/Items Management/Get the number of items in a list/description.md
index b54e0377..c647cb03 100644
--- a/Items Management/Get the number of items in a list/description.md
+++ b/Items Management/Get the number of items in a list/description.md
@@ -1,29 +1,29 @@
New SharePoint Online Powershell cmdlet Get-SPOListItemCount which allows you to view the number of items in a list.
-
-
-
-
-
-
-
-Get all items in a contacts list and their properties
++ Get all items in a contacts list and their properties
```powershell
Get-SPOListItems -Username -Url -AdminPassword -ListName -IncludeAllProperties $true (example shows only one of multiple retrieved items)
```
-
+
Get all items in a list and their properties and export to CSV
```powershell
Get-SPOListItems -Username -Url -AdminPassword -ListName -IncludeAllProperties $true | Export-CSV
```
-
-Get all contacts from a contact list that belong to a specific company
++ Get all contacts from a contact list that belong to a specific company
```powershell
Get-SPOListItems -Username trial@trialtrial123.onmicrosoft.com -Url https://trialtrial123.sharepoint.com/sites/teamsitewithlists -AdminPassword Pass -ListTitle "Contacts list" -IncludeAllProperties $true | where {$_.Company -eq "Uogiavv"} | select Title, Company
```
-
+
++ Get all properties of a document as a list item*
-
-
-Get all properties of a document as a list item*
-
-
-
-
-
-
-
+
Get a list of all documents in a document library
```powershell
Get-SPOListItems -Username trial@trialtrial123.onmicrosoft.com -Url https://trialtrial123.sharepoint.com/sites/teamsitewithlists -AdminPassword Pass -ListTitle "Documents" -IncludeAllProperties $true | select FileLeafRef
```
+
-
-
-
-
-
-Get a list of all documents in a document library, including folders and subfolders
++ Get a list of all documents in a document library, including folders and subfolders
```powershell
Get-SPOListItems -Username trial@trialtrial123.onmicrosoft.com -Url https://trialtrial123.sharepoint.com/sites/teamsitewithlists -AdminPassword Pass -ListTitle "Documents" -IncludeAllProperties $true -Recursive | select FileLeafRef
```
-
-Get a list of all Excel documents in a document library
++ Get a list of all Excel documents in a document library
```powershell
Get-SPOListItems -Username trial@trialtrial123.onmicrosoft.com -Url https://trialtrial123.sharepoint.com/sites/teamsitewithlists -AdminPassword Pass -ListTitle "Documents" -IncludeAllProperties $true | where {$_.File_x0020_Type -eq "xlsx"} |select FileLeafRef
```
-
-
-
+
-
-
-Get a list of all Excel documents in a document library and export to CSV
++ Get a list of all Excel documents in a document library and export to CSV
```powershell
Get-SPOListItems -Username trial@trialtrial123.onmicrosoft.com -Url https://trialtrial123.sharepoint.com/sites/teamsitewithlists -AdminPassword Pass -ListTitle "Documents" -IncludeAllProperties $true | where {$_.File_x0020_Type -eq "xlsx"} |select FileLeafRef | export-csv
```
-
-
-
-
-
-
-
+
+
-Update a column for all items using Get-SPOListItems cmdlet
-(Here we will be updating Title column to be called "Title" + the item ID number
++ Update a column for all items using [Get-SPOListItems cmdlet](https://gallery.technet.microsoft.com/scriptcenter/GetSpoListItems-and-a8ecd5fa)
+(Here we will be updating Title column to be called "Title" + the item ID number
+
And the result:
+
+
-Remove-SPOListItemPermissions
+## **Remove-SPOListItemPermissions**
Removes all permissions for an item. Only the user running the cmdlet will have access
-
-
-Parameters
-
-
+### *Parameters*
The cmdlet is using the following parameters:
-
+```powershell
[string]$Username
+ ```
The string specifies admin of the site
-
+```powershell
[string]$Url
+```
Specifies the url of the site
-
-[string]$AdminPassword,
+```powershell
+[string]$AdminPassword,
+```
Admin's Password
-
+```powershell
[string]$ListTitle
+```
Mandatory. Specifies list title where the item is located
-
+```powershell
[Int]$ItemID
+```
Mandatory. Specifies item ID
-Example:
+## *Example:*
-Remove the permissions
-Remove-SPOListItemPermissions -Username trial@trialtrial123.onmicrosoft.com -Url https://trialtrial123.sharepoint.com -AdminPassword Pass -ListTitle chc1 -ItemID 4
++ Remove the permissions
-
-
-
-
-
-
-
+Remove-SPOListItemPermissions -Username trial@trialtrial123.onmicrosoft.com -Url https://trialtrial123.sharepoint.com -AdminPassword Pass -ListTitle chc1 -ItemID 4
-
+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