Archive for the 'Uncategorized' Category

Office 365 storage utilization alerts with a Power Automate workflow

What happens when you run out of Office 365 storage? In some high-end Office 365 licensing plans, Microsoft will allow you to temporarily to exceed your storage quota until you purchase additional GBs. And for the rest of us? You will be abruptly cut off and your users will be greeted with an annoying message saying that the site has been placed in read-only mode. You’ll get a nasty-gram below saying that you’ve run out of storage and you need to buy more storage ASAP. Panic ensues…

Note: This message can also be generated when your SharePoint site collection reaches its quota. See more details here.

So how do we avoid this aggravating situation? With a Power Automate workflow.

Here I will share the tricks how to do it, because as I found out, there is no clear and documented method or API how to accomplish this.

The hardest part was to find out how to get into the Power Automate Flow the information about the maximum and the used storage quota. In the hope this will save you some time, I am sharing my findings, made after sniffing the network communication on the SharePoint admin center page that is showing this info. It seems there is an internal REST API, which gives this information (but I could not find its documentation). This REST GET call has the URL:

https://%5Btenant%5D-admin.sharepoint.com/_api/StorageQuotas()?api-version=1.3.2

NOTE: Authenticate with admin user that has permissions to see the SharePoint Admin page.

This REST method returns an XML or a JSON structure, depending on request. Our Flow will use the Action “Send an HTTP request to SharePoint”, requesting a JSON response, which looks like:

{

  “d”: {

    “results”: [

      {

        “__metadata”: { … },

        “GeoAllocatedStorageMB”: “0”,

        “GeoAvailableStorageMB”: “1073117”,

        “GeoLocation”: “NAM”,

        “GeoUsedStorageMB”: “16419”,

        “QuotaType”: 0,

        “TenantStorageMB”: “1089536”

      }

    ]

  }

}

The interesting info is “TenantStorageMB” and “GeoUsedStorageMB“. From them you can calculate the used quota percentage.

The Flow I built contains the following actions:

Then I am using a Condition to check if the used quota has reached my configured percentage and if it did send I use a send email action to inform the SharePoint Administrator and use the variables from the flow to compose a useful email:

Note: This Power Automate workflow needs to be created by a SharePoint user who has administrative permissions to be able to call the SharePoint REST API.

This workflow will execute once every day and if the storage quota is met, it will send out an email notification, like this one:

To download a copy of the workflow package, click here.

ACKNOWLEDGEMENTS:

A big thank you to Alex Baumgarten for his tremendous skills in developing this workflow and solving the technical challenges during its development. If you need a similar Power Automate workflow built, please contact Alex here.

Recover SharePoint 2013 installation key

I was reinstalling SharePoint 2013 Server in the lab tonight and discovered that I didn’t have the original license key that it was installed with. Googled online and found a number of Powershell scripts that claim to recover the key from the registry, but none of them worked – except this one, which was originally posted as a comment by KEMiCZA here. I can confirm that it worked for me.

This one should work SP-2013
function Get-SP2013ProductKey {
$map=”BCDFGHJKMPQRTVWXY2346789″
$value = (get-itemproperty “HKLM:\SOFTWARE\Microsoft\Office\15.0\Registration{90150000-110D-0000-1000-0000000FF1CE}”).digitalproductid
$baseAddress = 808
$needsN = ($value[$baseAddress + 14] -shl 3) -and 1;
$ProductKey = “”
for ($i = 24; $i -ge 0; $i–) {
$r = 0
for ($j = 13; $j -ge 0; $j–) {
$test = $value[$baseAddress + $j]
$r = ($r * 256) -bxor $value[$baseAddress + $j]
$floor = [math]::Floor(double)
$value[$baseAddress + $j] = $floor
$r = $r % 24
}
$ProductKey = $map[$r] + $ProductKey
}
if($needsN)
{
$firstLetterIndex = 0
for ($i = 0; $i -lt $ProductKey.Length; $i++) {
if($ProductKey[0] -eq $map[$i])
{
$firstLetterIndex = $i
break
}
}
$ProductKeyWithN = $ProductKey = $ProductKey.substring(1) # Remove first character
$ProductKeyWithN = $ProductKeyWithN.SubString(0, $firstLetterIndex) + “N” + $ProductKeyWithN.SubString($firstLetterIndex)
$ProductKeyWithN = $ProductKeyWithN.SubString(0, 5) + “-” + $ProductKeyWithN.SubString(5, 5) + “-” + $ProductKeyWithN.SubString(10, 5) + “-” + $ProductKeyWithN.SubString(15, 5) + “-” + $ProductKeyWithN.SubString(20, 5)
}
$ProductKeyWithN
}
Get-SP2013ProductKey

SharePoint 2013 Hidden User List

<sitecollectionurl>/_layouts/15/people.aspx?MembershipGroupId=0

Powershell script to export BDC models from SharePoint

This Powershell script exports Business Data Connectivity (BDC) service models from SharePoint.

# Get list of of all bdc models

$bdcs = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType “Model” -Name * -ServiceContext http://sharepoint

foreach($bdc in $bdcs)
{

# create a unique file name using the bdc name

$path = “.\$($bdc.DefaultDisplayName).bdcm”

# fetch the BDC object

$Model = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType “Model” -Name $bdc.DefaultDisplayName -ServiceContext http://sharepoint
Export-SPBusinessDataCatalogModel -Force -Identity $Model -Path $path

}

This script was developed by Dhejo Prothasis, Lead Architect at Acquiresoft Solutions.

Malaysia Airlines flight MH17 tribute

Ok, so this is not going to be a SharePoint or technology-related post..   Two days ago, a Malaysian Airlines flight Mh17 was shot down over eastern Ukraine by pro-Russian rebels.  This strikes close to home for me because I was born in Kyiv, Ukraine, and emigrated to the U.S. in 1991.  I’ve been following the news of the crash (and prior to that, the proxy war that Russian has been waging in eastern Ukraine).    I put together a video tribute to the victims of this awful tragedy – see links below.   As one U.S. intelligence official put it, “Let’s hope that this leads Vladimir Putin to a moment of sanity.”   Our prayers are with the victims and their families..

 

Malaysia Airlines MH17 Tribute

Vimeo (All locations):    https://vimeo.com/101144961

YouTube (Only viewable outside of the U.S.):    https://www.youtube.com/watch?v=sITF8mje0aI

 

 

 

Samurai Jack teaches SharePoint troubleshooting

Check out my little animated YoutTube video on SharePoint troubleshooting:

(Using animated clips from the old Cartoon Network show “Samurai Jack”)

How to export and import lists and libraries from a SharePoint 2010 site using Powershell

Let’s imagine this scenario:

You have an old SharePoint 2010 site and you need to copy its content to another SharePoint farm.  The site is heavily customized and moving it using traditional methods (backup/restore, export/import, save site as a template) are not going to work well.  Plus you only want content – no need to bring in all of that custom branding baggage.

You can copy the content using PowerShell and two scripts shown below.

Script # 1:   Export all lists and libraries from the source site.


add-pssnapin microsoft.sharepoint.powershell

# specify the site URL to export

$web = Get-SPWeb "http://sharepointURL/sites/site1/web1"

# specify output folder to store exported lists

$path = "c:\admin\export\"

foreach($list in $web.lists)

{

"Exporting " + $list.RootFolder.URL

export-spweb $web.URL -ItemUrl $list.RootFolder.URL -IncludeUserSecurity -IncludeVersions All -path ($path + $list + ".cmp") -nologfile

}

The output of this script should be a number of CMP files in the output directory.  Review these files and remove the lists that should not be imported (such as various Gallery lists).

Script # 2:  Import CMP files into the destination site.


add-pssnapin microsoft.sharepoint.powershell

# specify target SharePoint site to import into

$site = "http://sharepoint/sites/test1"

# specify folder containing exported lists

$folder = "C:\Admin\Import\"

$Files = Get-ChildItem $folder

foreach ($file in $files)
{

$name = $file.Name

"Importing: " + "$folder$name"

import-spweb $site -path ("$folder$name") -includeusersecurity -nologfile

}

Creating a SharePoint 2010 Search Service application using PowerShell

Here’s a great script by Jeremy Jameson on how to create a SharePoint 2010 Search service application with Powershell.

http://blogs.msdn.com/b/jjameson/archive/2011/02/28/powershell-script-to-configure-search-in-sharepoint-server-2010.aspx

I was even able to use it to configure search on a SharePoint 2010 server which was not joined to the domain (as sometimes is required for DMZ deployments).  It worked beautifully using local computer accounts.   There is a change that needs to be made to the script if you’re using local accounts:

Add ShareName and Index arguments as shown below.

$queryComponent = New-SPEnterpriseSearchQueryComponent -QueryTopology $queryTopology -IndexPartition $indexPartition -SearchServiceInstance $queryInstance -Debug:$false -ShareName  <SHARENAME>  -IndexLocation <INDEXLOCATION>

 

Creating a SharePoint 2010 Search Service application using PowerShell

Here’s a great script by Jeremy Jameson on how to create a SharePoint 2010 Search service application with Powershell.

http://blogs.msdn.com/b/jjameson/archive/2011/02/28/powershell-script-to-configure-search-in-sharepoint-server-2010.aspx

I was even able to use it to configure search on a SharePoint 2010 server which was not joined to the domain (as sometimes is required for DMZ deployments).  It worked beautifully using local computer accounts.

 

Some SharePoint Anagrams…

Courtesy of the Internet Anagram Server (http://wordsmith.org):

The word “SharePoint” can be re-arranged into the following phrases:

Tear Siphon
Orphan Site
Pain Others
Train Hopes
A Pot Shrine
A Shoe Print
A The Prison
A Open Shirt
A Person Hit
Share No Tip
Heat Or Snip
Hate Or Spin
Parent So Hi
Earn Oh Tips

🙂


RSS Information Week Headlines

  • An error has occurred; the feed is probably down. Try again later.

RSS SharePoint Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoPath Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Joel Oleson Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Bud Ratliff blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Susan Hanley’s KM Blog

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 383,448 hits