Browse Tag

OneDrive

OneDrive Files On-Demand And Windows Storage Sense – Impact of Combining Two Features

Files On-Demand and Windows Storage Sense are both useful features that you should be using especially when paired together. Used independently, each behaves as expected.

However, in an enterprise with mobile users (traveling or working offline), enabling both can cause confusion: files that go unopened for 30 days may be automatically offloaded (made online-only) by Storage Sense. From the user’s perspective, it can seem like OneDrive deleted their files, prompting support tickets. The takeaway for this post is, both features working exactly as designed and not doing something wrong. It’s about understanding what is occuring, why, and how to setup your users for success.

How Files On-Demand Works

OneDrive Files On-Demand is on by default, as it should be, and displays all your cloud files in File Explorer, with icons indicating each file’s status:

This is a screenshot directly from the Files On-Demand documentation and the overlooked part is what I highlighted in red which is details about Windows Storage Sense. One of the main differences between the green check mark with a white background (locally available file) vs the full green check mark (always available file) is that Windows Storage Sense will not convert the full green check mark back to the blue cloud (online-only) potentially without you knowing.

By default, new files appear as online-only, and Windows downloads them only when the user opens them. For example, if you double-click an online-only document (with an internet connection), it downloads and becomes locally available. Then you can either personally choose to move it back to online only or keep it on your device. But why does this matter and what should the user know?

This is where there can be a disconnect between the OneDrive administrator, or decider of policies, and the Windows device management personnel.

How Windows Storage Sense Works

Windows Storage Sense is an automatic disk-cleanup feature native in Windows. When it runs, it can dehydrate local OneDrive files. This converts them them from locally available (green check mark with a white background) back to online-only (blue cloud) to free space. Microsoft’s docs explain:

“Any files that you haven’t used in the last 30 days can be set to online-only when your device runs low on free space. Storage Sense will only set files to online-only until there’s enough space freed…”.

In Windows 10/11, the default threshold is 30 days. That means if a user hasn’t opened a file in 30+ days and Storage Sense triggers (i.e. the disk is nearly full), the file will become online-only. That sounds reasonable until you apply it to real-world enterprise usage patterns:

  • A user has a folder of reference documents they haven’t opened in 35 days
  • Their laptop disk gets low during a large software update
  • Storage Sense runs, dehydrates those files to online-only
  • The user boards a plane or goes into a location without internet, opens their laptop, tries to access those documents
  • Nothing opens. Windows throws an error. The user panics

From the user’s perspective, this feels like OneDrive did something to their files. In reality, the file remains safely in the cloud but Windows just removed its local copy. The support ticket could then be phrased “OneDrive isn’t working.” The resolution is to ensure the device is online education to right-click the affected folder and choose Always keep on this device.

Why Known Folder Move (KFM) Amplifies the Issue

Known Folder Move (KFM) redirects Desktop, Documents, and Pictures into OneDrive. If you use KFM, and if you aren’t you should be, then Storage Sense can operate on those critical folders. For example, if a user’s entire Documents is in OneDrive and files there go unused for 30 days, OR if the device administrator set a different policy, OR if the device is running low on space, Storage Sense might offload them to online-only status. A user who then goes offline loses access to all their files in their Documents folder. In a KFM-enabled environment without awareness, it’s easy for users to lose offline access to files unless they mark them as always offline prior to travel or times you know you will be offline.

True story…one of the genesis of this post is due to a time I went onsite and couldn’t get on guest wireless and we were in a basement and hot spot wasn’t working and I couldn’t pull up a presentation.

Mitigation Strategies

The good news is there are several ways to control this behavior through policy. The bad news is admins may not know these exist.

Option 1: Disable Storage Sense via Intune or GPO

The nuclear option. If your users have enough disk space and you’d rather not think about, turn Storage Sense off. This is not what I recommend.

Via Intune (Settings Catalog):
Search for “Storage Sense” in the Settings Catalog and set Allow Storage Sense Global to Block.

Via GPO:
Computer Configuration > Administrative Templates > System > Storage Sense
Set Allow Storage Sense to Disabled

Option 2: Prevent Storage Sense from Dehydrating OneDrive Files

This is the better option for most companies. Keep Storage Sense running for general disk cleanup but stop it from touching OneDrive files.

Via Intune (Settings Catalog):
Search for “Storage Sense” in the Settings Catalog and set Config Storage Sense Cloud Content Dehydration Threshold to 0 (zero means never dehydrate).

Via GPO:
Computer Configuration > Administrative Templates > System > Storage Sense
Set Configure Storage Sense Cloud Content dehydration threshold to 0

Option 3: Use OneDrive’s Disk Space Threshold Policies

OneDrive has its own sync policies for managing disk usage that give you more granular control than Storage Sense. These work alongside each other if configured correctly.

Minimum disk space threshold in MB: OneDrive will pause syncing if available disk space falls below this value.

This can also be set via GPO with MinDiskSpaceLimitInMB.

Option 4: Pin Critical Folders as “Always Available”

For users whose roles require offline access to specific folders, you can set folders to always be available locally. This can be done by the user or scripted as part of your deployment.

1. Via user’s pinning it themselves by right clicking on the folder or file and selecting Always keep on this device.

This is what should be made into a KB article with details as to WHY to do this!

2. Via PowerShell (run on user’s device during something like a login script). This can be helpful for remote field workers required to use OneDrive sync when working offline in areas without internet service:

# Pin a specific OneDrive folder as always-available locally
# Replace the path with the actual OneDrive folder path on the device

$folderPath = "$env:USERPROFILE\OneDrive - Contoso\Important Documents"

if (Test-Path $folderPath) {
    # Use attrib to set the pinned state (U = unpinned, P = pinned)
    # OneDrive uses the file attribute to track pin state
    attrib +U -P $folderPath /S /D
    Write-Host "Folder pinned as always-available: $folderPath" -ForegroundColor Green
} else {
    Write-Host "Path not found: $folderPath" -ForegroundColor Red
}

Note: There’s no OneDrive policy to remotely pin specific user files or folders as always-available, which is a gap in the toolset.

What to Tell Your Help Desk

In the meantime while you are creating that KB article, if users are already hitting this problem, just have them:

  1. Ensure the device has an internet connection
  2. Navigate to the affected folder in Windows Explorer
  3. Right-click the folder and select Always keep on this device
  4. Wait for sync to complete

The files will re-download. Nothing was ever deleted. But you’re going to want to get ahead of this with policy and internal KBs. This is something that should be reviewed for what option(s) to do especially if you’re rolling out KFM.

The Bottom Line

This isn’t a bug. Both features are doing what they’re supposed to do. But in an enterprise environment where users travel, lose connectivity, or work from devices with constrained disk space, the combination of KFM + Files On-Demand + Windows Storage Sense without proper policy controls and education to users could raise support tickets.

Understand the Storage Sense policies, your device fleet, your OneDrive policies, and test your configuration before rolling to production. Your help desk may thank you in the future!

Vlad & Drew Microsoft Cloud Webinar Series

There is a constant release of new Microsoft cloud technologies and it is hard to keep up to date. There can be features that are released and the not widely seen or there could be questions about that feature that aren’t answered with the initial release. We want to try to close that gap of knowledge.

Vlad Catrinescu and myself, Drew Madelung, have begun putting together a webinar series where we will be targeting Microsoft modern workplace technologies and doing deep dives into specific feature releases. We want to bring experts from Microsoft and the community to share the details of what is being released and break down into the technology to really try to help everyone understand what the feature is meant to do, can do, and answer any outstanding questions.

Please join us and spread the word for these webinars. If you missed one, make sure you watch the recording! And if you have any suggestions for topics to deep dive into please let Vlad or myself know.

Upcoming Webinars

Previous Webinars

August 25th – Modern records management in a new world of remote work with Microsoft 365

In this webinar we were joined by special guests Roberto Yglesias and Tina Ying covering the latest news in Microsoft 365 records management. Records management in M365 has many new features and capabilities that we highlighted in this webinar. We also discussed real-world conversations on use cases of moving to modern records management in M365 and the challenges, opportunities, and overall guidance for this process.

August 3rd – Introducing Microsoft Lists – Your smart information tracking app in Microsoft 365

In this webinar, we jumped into the new functionality and features of the brand new solution called Microsoft Lists. We discussed what Lists can be used for, how to work with them, and details around the timing and availability of Lists along with demos of Lists themselves! With our special guest Mark Kashman who joined us this was a great overall webinar with a ton of questions.

July 7th – Enabling Sharing & Collaboration in OneDrive & SharePoint

In this webinar, we dived into sharing and discussing how it works, how it can be managed, and what’s new and upcoming in the world of sharing and collaboration in OneDrive and SharePoint. We were joined by Stephen Rice from Microsoft as we break down the details and background of sharing.

June 16 – Evolution of Office 365 Groups to Microsoft 365 Groups

In this webinar, we’ll were joined by Mike McLean from the Microsoft 365 Groups product team to discuss the evolution of Office 365 Groups to Microsoft 365 Groups. We reviewed the Office 365 Groups journey, and provided a behind-the-scenes look at the vision and strategy around the platform. Mike also shared details on improvements recently shipped that enhance how groups are managed across the Microsoft 365 suite and through Microsoft Graph.

May 20 – Review of the new experiences of managed metadata services (taxonomy and content types)

We were joined by product managers Sean Squires and Anupam Francis covering updates to the managed metadata service in Microsoft 365! In this webinar we talked about the updates coming to the managed metadata service. This includes experience updates to the term store, a new admin content type gallery, and improvements to managed metadata columns in lists and libraries. We will also talked about the new REST and Graph APIs supporting taxonomy updates.

May 26 – Enabling Sensitivity Labels for SharePoint Sites, Teams, Office 365 Groups and Office files

We were joined by Senior Program Manager Sanjoyan Mustafi for a free webinar covering Sensitivity Labels across Office 365! In this webinar we talked about the upcoming features around enabling more Office 365 workloads with sensitivity labels. This included new abilities to classify the containers of Office 365 Groups, Microsoft Teams, and SharePoint sites and the ability to enable sensitivity labels for Office files in SharePoint and OneDrive.

March 10th – Deep Dive into SharePoint Online Multilingual

We had the pleasure to host a webinar with Senior Program Manager Divyachapan (DC) Padur, and Senior Software Engineer Matt Mooty from Microsoft for a deep in multilingual in SPO. Recording below and a great collection of questions and answers came from it that we posted.

April 9th – Deep Dive into OneDrive Known Folder move

We were joined by Principal Program Manager Gaia Carini from the OneDrive team at Microsoft to talk all about Known Folder move. Recording is below.

Drew @ Ignite 2018

I can’t wait for Microsoft Ignite 2018 this year in Orlando. I was honored to be selected as featured speaker earlier this year for this event. The list of speakers and sessions this year is incredible and I can’t believe I am able to join them as a presenter again this year. If you aren’t able to attend, all sessions (including theaters!) will be live streamed. If there is one that you don’t want to miss make sure you make Jeff Teper’s collaboration keynote on Monday at 4:00 p.m.

This is an exciting time to be working in the Microsoft collaboration space. We have seen the explosion of Teams, the resurgence of SharePoint, the overwhelming adoption of the SharePoint Framework and so much more. I am sure the next set of announcements will not disappoint. 

My sessions

Session 1 – BRK3273 – From start to finish: How to create your modern SharePoint site provisioning solution

Tuesday, September 25 – 10:15 AM – 11:00 AM – OCCC W304 A-D

I am lucky to present this session with a good friend and great speaker Vlad Catrinescu.

Details: Creating modern SharePoint sites only takes a second but what if you want to customize or control that process? It can be a challenge to keep up with all the sites in an organization and can affecat support and governance of a SharePoint environment. In this session, learn how to use Microsoft’s latest tools such as Site Designs, Site Scripts, PnP Site Provisioning, PowerApps and Flow to create a full site provisioning system with custom templates, custom branding, and easy approval before creation!

Session 2 – THR2142 – What you need to know about managing OneDrive for Business

Wednesday, September 26 – 4:35 PM – 4:55 PM – Expo Theater #6

Details: OneDrive for Business is a key workload in Office 365 and should be an integral part of your collaboration strategy. OneDrive provides a cloud location to store, share, and sync your work files and then work with them from any device. OneDrive for Business management needs to be done to support the user and the administrator to ensure the content is always secure. What happens to OneDrive content when someone leaves? What devices have content synced to them? What limits are there and do the users know about them? Learn more about what management capabilities are available and which ones are needed within your enterprise.

Session 3 – Under the Hood Ignite special: Hub sites with Drew Madelung

Tuesday, September 25 – 2:00 PM – 2:45 PM – Immersion Zone Podcast 2

Details: Are you a fan of Under the Hood with Nick Brattoli, or do you want to learn how SharePoint hub sites are being implemented in the real world? If so, head over to the podcast center and listen to host Nick Brattoli and special guest Drew Madelung as they talk about their experiences. 

They discuss topics such as: 
• Changes organizations can make to their information architecture to take advantage of hub sites 
• Navigation schemas that are intuitive and scale well 
• Security and governance models 
• Tips and tricks to provision sites quickly 
• Challenges and workarounds 

Sharing a File in SharePoint Online or OneDrive with PowerShell

I have been diving into doing larger scale operations in SharePoint Online using the Client Side Object Model (CSOM) utilizing PowerShell and ran into a scenario that I couldn’t easily find documented anywhere. What I wanted to do was technically “share” a file with a specific user and have that user receive an email just like if it was done through the GUI. What I didn’t want to see is just the breaking of permissions. What I found was the Web.ShareObject method and this great blog post from Vesa Juvonen in 2015

Once I found this I started working on putting this into a useful PowerShell format. To get started with CSOM & PowerShell with SharePoint Online here is a good blog post from Chris O’Brien. You can get the latest version of SharePoint Online CSOM here. If you download the nuget file you can change the file extension to .zip and extract the .dlls.

Here is link to the GitHub rep and I will break it down below along with the script. Here are some key things to note:

  • The Web.ShareObject method has been updated since the Vesa blog post with a parameter called useSimplifiedRoles that can be used for utilizing modern sharing
  • SharePoint PnP has extended the sharing APIs and built a sample that can be used
  • This script is built to share a file based on filename within a site to a single user
  • This works on SharePoint Online and OneDrive for Business
  • It will share as the user who runs the script
  • This script could be updated to share a site or to multiple people
  • You can share with Edit or View permission based on the roleValue
  • It doesn’t replicate the modern sharing UI in capabilities exactly (more of what occurs details below)

To utilize the script make sure you fill out the appropriate variables and more information about what this will do is below the script. 

# Use this script to share a file via CSOM and PowerShell
# ShareObject https://msdn.microsoft.com/en-us/library/office/mt684216.aspx
# External sharing blog https://blogs.msdn.microsoft.com/vesku/2015/10/02/external-sharing-api-for-sharepoint-and-onedrive-for-business/

### ENTER YOU VARIABLES HERE ###

#path to the SP CSOM files 
$csomPath = "C:\...." 

#Email of person running the script
$adminEmail = "user@domain.com"

#Site collection to be connected to
$siteUrl = "https://site.sharepoint.com/sites/site"

#Library title where the file exists
$libraryTitle = "Documents" 

#Filename including file type
$fileName = "Test Document 1.docx"

#Email of who the document is being shared to
$emailSharedTo = "user2@domain.com"

#UNVALIDATED_EMAIL_ADDRESS if they are in AD or GUEST_USER if they are not
$principalType = "UNVALIDATED_EMAIL_ADDRESS"  

#role:1073741826 = View, role:1073741827 = Edit
$roleValue = "role:1073741827"

#A flag to determine if permissions should be pushed to items with unique permissions.
$propageAcl = $true

#Flag to determine if an e-mail notification should to sent, if e-mail is configured.
$sendEmail = $true  

#If an e-mail is being sent, this determines if an anonymous link should be added to the message.
$includedAnonymousLinkInEmail = $false  

#The ID of the group to be added to. Use zero if not adding to a permissions group. Not actually used by the code even when user is added to existing group. 
$groupId = 0

#Doesn't matter as it isn't sent in current email format
$emailSubject = ""

#Text for the body of the e-mail.
$emailBody = "Check out my email body"  

#Use modern sharing links instead of directly granting access
$useSimplifiedRoles = $true
################

# Get CSOM files
Add-type -Path "$csomPath\Microsoft.SharePoint.Client.dll"
Add-type -Path "$csomPath\Microsoft.SharePoint.Client.Runtime.dll"

# Connnect to site
$ss = Read-Host -Prompt "Enter admin password" -AsSecureString
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($adminEmail, $ss)
$ctx.Credentials = $creds
if(!$ctx.ServerObjectIsNull.Value) { 
    Write-Host "Connected to site:" $siteUrl -ForegroundColor Green 
} 
# Get web
$web = $ctx.Web

# Connect to library
$list = $web.Lists.GetByTitle($libraryTitle)
$ctx.Load($web)
$ctx.Load($list)
$ctx.Load($list.RootFolder)
$ctx.ExecuteQuery()

# Get doc
$query = New-Object Microsoft.SharePoint.Client.CamlQuery
$caml ="<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='File'>" + $fileName + "</Value></Eq></Where></Query></View>"
$query.ViewXml = $caml
$item = $list.GetItems($query)
$ctx.Load($item)
$ctx.ExecuteQuery()
if (!$item) {
    Write-Host "Could not find the file:" $fileName -ForegroundColor Yellow 
} else {
    Write-Host "Sharing the the file:" $item.FieldValues.FileLeafRef -ForegroundColor Green 
}

# Get doc url
$itemUrl = $item.FieldValues.FileRef
$split = $web.Url -split '/'
$itemUrl = "https://" + $split[2] + $itemUrl

# Build user object to be shared to
$jsonPerson = "[{`"Key`":`"$emailSharedTo`",
`"Description`":`"$emailSharedTo`",
`"DisplayText`":`"$emailSharedTo`",
`"EntityType`":`"`",
`"ProviderDisplayName`":`"`",
`"ProviderName`":`"`",
`"IsResolved`":true,
`"EntityData`":{`"Email`":`"$emailSharedTo`",
    `"AccountName`":`"$emailSharedTo`",
    `"Title`":`"$emailSharedTo`",
    `"PrincipalType`":`"$principalType`"},
`"MultipleMatches`":[]}]"

# Initiate share
$result = [Microsoft.SharePoint.Client.Web]::ShareObject($web.Context,$itemUrl,$jsonPerson,$roleValue,$groupid,$propageAcl,$sendEmail,$includedAnonymousLinkInEmail,$emailSubject,$emailBody,$useSimplifiedRoles)
$web.Context.Load($result)
$web.Context.ExecuteQuery()

Write-Host "Status of the share:" $result.StatusCode -ForegroundColor Green

Starting from a non shared file this is what you will see based on different configurations:

Sharing with useSimplifiedRoles set to $true and sendEmail set to $true

  • The file does not have inheritance broken

  • After initiating the ShareObject, inheritance is broken but you don’t see any changes

  • The person being shared to receives an email that the person who ran the script wants to share a file with you and you will see the email subject is preset but the email body is included

  • Once the person being shared to clicks on the link you can see a new ‘Managed Links’ section in the item permissions

  • If you follow that link you will see the item is now shared with that individual

Sharing with useSimplifiedRoles set to $true and sendEmail set to $false

  • The file does not have inheritance broken
  • After initiating the ShareObject, inheritance is broken but you don’t see any changes if the user tries to access the file through the document library
  • There is a new link viewable in the modern manage access section showing a new sharing link and that someone can access via that link

  • If the user accesses the file via that link you can see a new ‘Managed Links’ section in the item permissions and you can see that user in the Shared with section

 

Sharing with useSimplifiedRoles set to $false and sendEmail set to $false

  • The file does not have inheritance broken
  • After initiating the ShareObject, inheritance is broken but you don’t see any changes even after a user accesses the file, that means this does nothing but break inheritance

Sharing with useSimplifiedRoles set to $false and sendEmail set to $true

  • The file does not have inheritance broken
  • After initiating the ShareObject, inheritance is broken but you don’t see any changes
  • Once a user accesses the file via the link in the email they are granted permissions directly to the file (contribute instead of edit)

Ending…

After putting this together I realized I don’t really have a great use case to actually use this. Either way it was a good learning experience for me as I am just getting started into this kind of CSOM & PowerShell work and maybe it will come in handy for someone else in the future. 

SharePoint, OneDrive & Office 365 Collaboration Announcements from Ignite 2017

I will be keeping track of all of the announcements that I can keep up with around SharePoint, OneDrive, and the Office 365 collaboration space at Microsoft Ignite next week using Sway. Since I am using Sway you will be seeing my updates live as I type and publish them.  That means this will be an evergreen Sway and hopefully a 1 stop shop for anyone looking to catch up on all the great news coming out of Ignite. 

 

  • 1
  • 2