Monday 24 May 2021

Migrating Multiple Teams between 2 tenants from a list of URL's using ShareGate PowerShell.

If you are lucky enough to have a license to ShareGate, you may find yourself using the Copy Team functionality. The Desktop App is pretty good if you want to move multiple teams with a nice search function and it even lets you know if there are Team name conflicts before you start migrating.

However if one or both of your tenants have thousands of Teams, the list of Teams in the ShareGate Desktop app can take a very long time to fully load. In this case you may want to speed up the process by using a PowerShell script that reads from a text file containing a list of Teams URL's. Teams URL's aren't the most friendly, but they usually contain the Group ID, which can be used by the ShareGate PowerShell "Copy-Team" command. Note: there can be a conflict between the ShareGate module and the official Microsoft Teams PowerShell module, so I would recommend you avoid installing the Teams PowerShell module on your ShareGate server.

Here's the full script I created to copy a list of Teams:

$mySourceTenant = Connect-Tenant -Domain https://<<sourcetenantname>> -Browser -DisableSSO

$myDestTenant = Connect-Tenant -Domain https://<<destinationtenantname>> -Browser -DisableSSO

$sites = Get-Content -path "C:\scriptlocation\Sites.txt"

$idArr = New-Object System.Collections.ArrayList

#loop to create an array of group ID's

foreach ($s in $sites) {

    #This is only required if your list contains the full Team URL, if you already have the group ID you can remove the next 2 lines

    $endUrl = $s.Substring($s.IndexOf("groupId")+8)

    $gId = $endUrl.Substring(0, $endUrl.IndexOf("&"))



$teams = Get-Team -Id $idArr -Tenant $mySourceTenant -AllowMultiple

Copy-Team -Team $teams -DestinationTenant $myDestTenant

Tuesday 29 October 2019

Getting around the 256 row limit in the MS Flow Excel Action

If you find yourself using the "List rows present in a table" Excel function within Microsoft Flow, you may hit an issue where it can only return the first 256 rows of the table.

I suspect that this limit may be in place for performance reasons, so please proceed with the following steps with caution.

Here are the steps if you want to loop through more than 256 rows:

Initialize a variable called "TotalRows". This should be an "Integer" type and the default value should be 256.

Initialize a variable called "SkipCount". This should be an "Integer" type and the default value should be 0.

Create a "Do until" action. The condition should be to loop until the TotalRows is less than 256.

Add your "List rows present in a table" Excel action inside the Do Until from the previous step. Set the required settings as required. In the "Skip Count" field, add the "SkipCount" variable you created in step 2.

Under the "List rows present in a table" action, add a new "Set variable" action and set the TotalRows variable to the amount of rows returned from the previous action. To do this, use the following expression: length(body('List_rows_present_in_a_table')?['value'])

Next add a "Increment variable" action and increment the "SkipCount" variable by 256.

The idea here is to loop through the Excel 256 rows at a time.

Every time you loop, you skip an extra 256 rows (so first time it will skip 0, then 256, then 512 etc).
The Do Until just checks to see if there are less than 256 rows returned, because if that is true you know you are at the end of the Excel file.

All actions that you want to perform on your Excel data should be done inside this "Do until" loop.

Thursday 17 January 2013

SharePoint 2010 Organization Browser and Content Query web part conflict

Just a quick note for people experiencing problems with the SharePoint 2010 Organisation browser not rendering when they have a content query web part (CQWP) on the page. To fix the problem add the following attribute to all CQWP's on the page:


Wednesday 9 December 2009

IE6 survival guide

I decided to write a guide on how to avoid potential display issues when you have to support IE6 in a project. Whilst I would love not to have to worry about IE6, the simple fact is there are still a lot of people on the web still using the 8 year old browser, and many companies are not able to upgrade their browser due to internal systems relying on it and due to upgrade costs. Whilst working with RNIB and the WAC it was also clear that many blind or partially sighted users are reluctant to upgrade when they know their browser works with their current screen reader software.

I am not a fan of IE6 hacks or browser specific CSS files. The reason for this is often hacks can cause CSS validation to fail, and browser specific CSS files often require script on the page to detect the browser. The approach I like to take is to understand the pitfalls of IE6 and then code your CSS and HTML in way that avoids conflict in the first place. There are lots of different issues surrounding IE6, but I am going to talk about the most commonplace issues that I have found whilst working on a variety of websites/intranets.

Box model

An overview:

The box model is a term used to describe the way that browsers add width, padding, margin and borders to an element. The diagram below is how W3 describes the box model:

The problem:

A lot of the problems people encounter with layouts and elements looking different in IE6 are to do with the different approach the browser takes to rendering the box model. Whilst all the modern browsers (including IE7 and IE8) add padding onto the calculated width of an element, IE6 includes the padding in the width of the element. So if you have a class that has a width of 100px and a left padding of 10px, most browsers will display the element as 110px wide. However IE6 will display the element as 100px wide and simply push the contents in 10px. In a way the IE6 approach makes more sense, for example if you were going to sound proof a room by padding the walls, the exterior width of the room would not increase, but the content inside would have less room.

The solution:

The simple solution to avoiding cross browser problems with the box model is to not mix width and padding. Although this often causes extra markup on the page, the amount of time it can avoid fixing issues for IE6 more than makes up for it. For example, if you have the following HTML:

<div class="myclass">




If the class called myclass has a width of 180px and you wanted to add 15px padding to it, you could either add padding to the h1 and paragraphs, or you could add another div inside the myclass div and assign the 15px padding to that e.g.

<div class="myclass">

<div class="myclass-inner">






An overview:

Using percentages for widths, margins and padding is particularly useful on flexible width sites. Making sure that your inner elements flow with the page as well as the layout is a great way to make use of all the available space. I don't recommend trying to use percentage heights as it often doesn't work and setting heights (fixed or otherwise) is generally a bad idea in terms of allowing for text resizing and content flow.

The problem:

IE draws objects on the screen using a "layout" property. I won't go too far into explaining this (as I don't fully understand it!), but all you need to know is that various HTML elements don't have "hasLayout" set to true by default, and this is what often causes various issues in IE6, including percentage widths, padding etc. often looking inconsistent with other browsers.

The solution:

To set an elements hasLayout to true you can use a few CSS tricks. The method you use will depend on your CSS, as you don't want to override a width or a position just to give something layout. So here is a list of CSS attributes you can apply to a class/ID to set it's hasLayout to true:

1. display:inline-block

This is a favourite of mine as it basically does nothing other than to give the element layout.

2. Set a height or width to anything other than auto

If you give an element a width or a height, IE will give that element layout. A trick often used is to add height:1%, as it will give the element layout but won't do anything else. Avoid using with overflow:hidden.

3. float:left / float:right

Gives an element layout, but you then have to clear your float, which can have its own challenges.

4. position: absolute / relative

This sets hasLayout to true, but I would avoid this unless you are using positioning on the site already.


The peekaboo bug is a term that describes disappearing backgrounds/borders/text in IE6 (and sometimes IE7). You can often spot it when you are scrolling up and down a page and something that wasn't there before suddenly is there or vice-versa.

The peekaboo bug is also caused by the hasLayout problem, so any of the above fixes for percentages will solve this problem.

Move on Hover/tab

If you ever see elements jump slightly when you hover over them/tab into them, this is again often caused by the hasLayout issue. So use any of the fixes listed in the percentages section above.

To PNG or not PNG?

An Overview:

PNG images are incredibly useful in that they give you variable transparency, unlike GIF's or JPG's. A GIF offers transparency, but each pixel either has its transparency set to on or off. In PNG's, you can have images that slowly fade into the background.

The problem:

IE6 does not support PNG-24 transparency. If you try to use a PNG with nice faded transparent edges (often useful with shadow borders) you will get a nasty colour replacing the once transparent sections of the image in IE6.

The solution:

There are lots of fixes on the web for this. I personally think a lot of them are complete overkill, often using a lot of lines of javaScript to filter the PNG's. For some sites I have used some invalid CSS to fix the problem:

.myclass {
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='background.png');

However, this fix only worked for CSS background image, so if you wanted an image on the page you would have to use javaScript. Also, it's invalid so it’s not great.

Now I have found a much nicer solution. You can actually get IE6 to accept transparent PNG's, you just have to save it in a particular way. The most reliable way I have found is to save it as a PNG-24 in Photoshop, and then open it up in Paint.NET (I have been told that Fireworks also works). Then you just save it out as a PNG-8. Unfortunately if you try to save it as a PNG-8 in Photoshop it doesn't seem to work, I'm not sure why. Sometimes the quality of the image can suffer slightly using this method, but I have found it is fine when you're using it for border shadows or curved corners.

General IE6 testing

It is worth setting up a VPC with IE6 before you start any development on a site that has IE6 as a requirement. Regular testing is the only way to catch bugs as they happen. Microsoft have various free VPC's available running different OS's and versions of IE available here:

If you don't/can't run Virtual PC, you can try installing Multiple IE from here:

However this isn't supported on Windows Vista or later.

Another tool is IETester which can be found here:

Please let me know if there are any common IE6 issues that you have encountered that I have missed above, and if there is a simple fix available for them.

Migrating Multiple Teams between 2 tenants from a list of URL's using ShareGate PowerShell.

If you are lucky enough to have a license to ShareGate, you may find yourself using the Copy Team functionality. The Desktop App is pretty g...