1

Is there any SharePoint Online PowerShell script available to export the value of "DefaultLinkType" of all the sites in Tenant to a CSV?

I am not able to find one.

2 Answers 2

2

There is no ready-made PowerShell script for your requirement. But, I will help you to build this script on your own.

Get DefaultLinkType property of a SharePoint site:

If you want to get the DefaultLinkType property of a SharePoint site then you can use:

$site = Get-SPOSite -Identity https://spexplorer.sharepoint.com/sites/SPConnect -Detailed
$site.DefaultSharingLinkType

Get all sites in tenant:

Connect-SPOService -Url https://xxx-admin.sharepoint.com
$sites = Get-SPOSite -Limit ALL

So you can use the for loop like below to get the site details:

Connect-SPOService -Url https://<tenant-name>-admin.sharepoint.com

$sites = Get-SPOSite -Limit ALL

foreach ($site in $sites) {
    $siteDetailed = Get-SPOSite $site.Url -Detailed 
    $siteDetailed.DefaultSharingLinkType
}
3
  • Refer this link as a reference to export data to CSV. Commented Mar 11, 2020 at 13:13
  • Have you tried this? is it working for you?? Commented Mar 12, 2020 at 10:10
  • Hi @George, does this answers your question? If Yes, please upvote and accept it as an answer so that it will not be shown in unanswered questions list. Commented Mar 23, 2020 at 9:14
0

Demo code for your reference:

Connect-SPOService
Get-SPOSite | Select @{ L = "url"; E = { $_.url } }, @{ L = "DefaultLinkType"; E = { $_.DefaultSharingLinkType } } | Export-Csv -Path c:\export.csv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.