Skip to content

Instantly share code, notes, and snippets.

Import-Module Sharegate
$csvFile = "C:\temp\CopyContentOneDrive.csv"
$table = Import-Csv $csvFile -Delimiter ","
$tenantsource = Connect-Site -Url "https://contoso-admin.sharepoint.com" -Browser
$tenantdest = Connect-Site -Url "https://tailspin-admin.sharepoint.com" -Browser
$copysettings = New-CopySettings -OnContentItemExists IncrementalUpdate
Set-Variable srcSite, dstSite, srcList, dstList
$source = Connect-Tenant -Domain contoso.onmicrosoft.com -Browser
$destination = Connect-Tenant -Domain tailspin.onmicrosoft.com -Browser
#Enter the date from when the sesion you want to run incremental on is from.
$sessions = Find-CopySessions -From "11/25/2022"
$sessions | ForEach-Object { Copy-TeamIncremental -SessionId $_.Id -SourceTenant $source -DestinationTenant $destination }
#Teams and SharePoint usage data consolidation script
#Author: Alexander Holmeset
#Twitter: @AlexHolmeset
function Get-MSGraphAppToken{
<# .SYNOPSIS
Get an app based authentication token required for interacting with Microsoft Graph API
.PARAMETER TenantID
A tenant ID should be provided.
#Authentication
$consumerToken = "Enter your consumer token here"
$employeeToken = "enter your employee token here"
#Expiration date of the authorization toke you generate is set to 1 day from now.
$expirationDate = get-date ((get-date).Adddays(+1)) -format "yyyy-MM-dd"
$uri = "https://tripletex.no/v2/token/session/:create?consumerToken=$consumerToken&employeeToken=$employeeToken&expirationDate=$expirationDate"
#Get token and create header.
$token = ((Invoke-RestMethod -Method PUT -Uri $uri -ContentType "application/JSON").value).token
$user = '0'
$ProjectsURL = "https://tripletex.no/v2/project?from=0"
$Projects = (Invoke-RestMethod -Method Get -uri $ProjectsURL -Headers $Header).values
### Teams Devices Configuration Profiles Uploader ###
### Version 1.0 ###
### Author: Alexander Holmeset ###
### Email: alexander.holmeset@gmail.com ###
### Twitter: twitter.com/alexholmeset ###
### Blog: alexholmeset.blog ###
### Thanks to Jens Madsen for idea and extensive CSV ###
### with predefined configuration profiles. ###
### https://twitter.com/JensHMadsen ###
$TenantId = "xxxxxxxx"
$ClientID = "xxxxxxxxx"
$ClientSecret = "xxxxxxx"
function Get-MSGraphAppToken{
<# .SYNOPSIS
Get an app based authentication token required for interacting with Microsoft Graph API
.PARAMETER TenantID
A tenant ID should be provided.
.PARAMETER ClientID
{
"type": "object",
"properties": {
"ProjectID": {
"type": "string"
},
"EmployeeName": {
"type": "string"
},
"EmployeeID": {
{
"type": "object",
"properties": {
"TimesheetEntryID": {
"type": "string"
}
}
}
{
"type": "object",
"properties": {
"RowID": {
"type": "string"
},
"Hours": {
"type": "string"
}
}