Thursday, July 1, 2021

SharePoint - Add Title Area to a modern page where it's missing

 I've found pages that for one reason or another are missing the Title Area with the banner.  In order to get that back, I just run the following on it (replacing the ID with the ID of the page you're trying to get):


$SiteURL = "https://vivity.sharepoint.com/sites/Test"

$ID = 12

Connect-PnPOnline $SiteURL -Credential (Get-Credential)

Get-PnPListItem -List SitePages

Set-PnPListItem -List SitePages -Identity $ID -Values @{"PageLayoutType"="Article"}


Thursday, March 25, 2021

PowerApps - Trouble passing parameters to Power Automate

 If you connect a Power Automate workflow to a PowerApp, you call the Run() method and can pass it parameters.  If the PowerApp isn't allowing you to add parameters to Run(), just select your object and under Action select Power Automate.  Remove the Flow and re-add it, and you should then be able to add the parameters you want to pass.





Tuesday, February 23, 2021

SharePoint Gallery View - Make images of people bigger

The gallery view in SharePoint is great, especially when used to show people.  For example, I've created a New Hire list that is populated by a Powershell script that pulls in any new hires nightly.  But the images for the people are tiny:

But it's SO CLOSE to what we're looking for!

So with a couple of quick edits, you can increase the size of those images.

  • From your Views, select "Format the current view":

And then select on Card Designer, then Advanced Mode


      

Copy the JSON and paste it into an editor.  Do a search for:

"src": "=getUserImage([$personIterator.email], 'S')"

And replace the 'S' with an 'L' to bring back the bigger image.

Next, find the following block:

"forEach": "personIterator in [$NewHire]",
                    "elmType": "a",
                    "attributes": {
                      "class": "=if(loopIndex('personIterator') >= 5, 'sp-card-userContainer', 'sp-card-userContainer sp-card-keyboard-focusable')"
                    },
                    "style": {
                      "display": "=if(loopIndex('personIterator') >= 5, 'none', '')"
                    },

Add a width and height property to the style section to the size that you'd like the image to be:


"forEach": "personIterator in [$NewHire]",
                    "elmType": "a",
                    "attributes": {
                      "class": "=if(loopIndex('personIterator') >= 5, 'sp-card-userContainer', 'sp-card-userContainer sp-card-keyboard-focusable')"
                    },
                    "style": {
                      "display": "=if(loopIndex('personIterator') >= 5, 'none', '')",
      "width": "100px",
      "height": "100px"
                    },

Pasted this JSON back in, save the view and you should be all set!



Monday, February 1, 2021

Teams: Tasks by Planner - We couldn't save your tab settings

If you're an owner of a team and you try to add the Tasks by Planner tab and get the "We couldn't save your tab settings. Please try again.":


Just make yourself a member temporarily and then you'll be able to create the tab.

Wednesday, September 30, 2020

Copy all views from one SharePoint list to another via Powershell

 Here's a PnP Powershell script that copies all views from one SharePoint list to another list:


# Url to the site
$siteUrl = "https://vivity.sharepoint.com"

# The list where we want to copy all of the views
$listWithViewsToCopy = "Banana"

# The list name to copy the views to
$listToCopyTo = "Pineapple"

Write-Host "Connecting to PnP..."
Connect-PnPOnline -Url $siteUrl -Credential (Get-credential)

# Get all the views and properties for the list
$viewsToCopy = Get-PnPView -List $listWithViewsToCopy -Includes "ViewQuery","ViewType","ViewData","ViewJoins","ViewProjectedFields","RowLimit","Paged"

# Loop through each view and create it in the new list
foreach ($view in $viewsToCopy)
{
   Write-Host "Adding View: "$view.Title
   # Loop through all fields and create an array

   $fields = [System.Collections.ArrayList]::new()

   foreach ($field in $view.ViewFields)
   {
      [void]$fields.Add($field)
   }

   # Add the new view
   Add-PnPView -List $listToCopyTo -Title $view.Title -Fields $fields -Query $view.ViewQuery -ViewType $view.ViewType -RowLimit $view.RowLimit
}

Thursday, June 11, 2020

Power Automate - Grant access to an item or folder: Add a SharePoint Group

In Power Automate, if trying to grant access to an item or a folder, and you try to use a SharePoint Group, it won't resolve and you'll get an error that the field is required.


But if you just Initialize a variable and assign it the name of the SharePoint Group:

And then use that variable instead:


You no longer get an error, and the group will get added with the access level specified when you run the flow!




Monday, June 8, 2020

Get-PnPListItem in a list with greater than 5000 items

If you need to grab all the items from a list with greater than 5000 items in SharePoint Online, you might get the following error:

The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator

To get around that, add a query with the scope of RecursiveAll to your query like so:

Connect-PnpOnline -Url 'https://vivity.sharepoint.com/sites/sitename' -Credentials (Get-Credential)
$query = "<View Scope='RecursiveAll'><RowLimit>5000</RowLimit></View>"
$items = Get-PnPListItem -List 'My List' -Query $query