Manual Workarounds For Applying Metadata After Drag And Drop Uploads In Sharepoint

The Core Issue With Drag and Drop

When users upload files to SharePoint document libraries using the drag and drop method, the files get uploaded without any metadata attached. This causes problems down the line when trying to search, filter, or organize files based on metadata tags. Without metadata classifications attached, documents end up poorly categorized in the system. Some core reasons metadata does not automatically get applied on drag and drop uploads include:

  • No metadata extraction on the backend – SharePoint does not actively extract metadata details from documents on upload
  • No mapping to columns – Drag and drop does not map embedded doc metadata to library columns
  • User context limitation – Uploads cannot inherit metadata from user profiles automatically

This forces users to enter metadata manually after uploading files or rely on poor search to find uploaded content. So solving this issue is key for a properly governed SharePoint environment.

Manual Workarounds To Apply Metadata

Until more robust solutions are put in place, several manual options exist to apply metadata after uploading content via drag and drop:

Using Library Settings to Add Default Metadata

Document library settings allow administrators to add default metadata values for certain columns. For example, a Contracts library could have “Public” set as the default value for the Sensitivity column. Any new uploads would automatically be tagged Public for sensitivity unless users manually changed the value. Though limited, this provides some automated metadata assignment.

Editing Metadata in the Item’s Context Menu

Once a document is uploaded, users can right click the item and select Edit Properties to open a details pane. Within this pane all metadata columns configured for that content type are available for editing. Users can fill in metadata details like category, status, client name, etc. to apply tags. This method allows full modification but requires user effort.

Opening and Editing in Microsoft Office Apps

For Office documents like Word, Excel, and PowerPoint files, users can open uploaded files directly and edit within Office apps. Within these apps, custom SharePoint metadata columns often sync back and forth. Entering details like project ID or account manager in Office allows propagating back to SharePoint metadata once saved. This helps classify files.

Copying Items and Metadata to Another Location

Users can manually copy or move uploaded items into locations that automatically apply specific metadata. This includes using content types with default values, adding to records center sites pulling from user profiles, or manually categorizing under managed metadata term sets. The downside is potential data sprawl. But copying with promoted metadata can help improve discovery.

Custom Solutions

In addition to manual workarounds, several custom solutions exist involving scripts, apps, and APIs to auto apply metadata after uploads:

Creating Power Automate Flows to Apply Metadata

Microsoft Power Automate flows provide a no-code way to add metadata to newly uploaded items. Flows can trigger on file upload and apply values from user profiles, content type defaults, lookup lists, or other sources to populate columns. This provides hands-off metadata without user input. The limitation is throttling thresholds on high usage.

Building Custom Scripts with PnP PowerShell

For organizations proficient with PowerShell, PnP PowerShell commands can recursively scan libraries and update metadata in bulk. This allows batch updating document metadata programmatically. By stitching together Get and Set commands, large batch uploads can be remediated adding in metadata details from delimiter separated files, client databases or other systems.

Leveraging REST APIs in Custom Applications

For advanced scenarios, custom built applications can leverage SharePoint REST APIs and POST methods to insert metadata on files immediately after upload. By hooking into the FileUploaded event with a provider hosted add-in, metadata defaults, lookups, and profile data can be applied dynamically with full flexibility. This provides fluid metadata application at scale.

Example Script for Applying Metadata in PowerShell

The PowerShell script below provides a reusable way to recursively scan through a document library and update metadata values in bulk. The script:

  1. Prompts user for credential context and the site URL
  2. Loads SharePoint CSOM assemblies automatically for API access
  3. Recurses through all folders pulling files
  4. Applies desired metadata like client name based on lookup list
  5. Updates metadata for all files in bulk
  6. Provides logging and confirmation on number updated


#Script to update metadata for all files in a SharePoint Online document library

#Load assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Get credentials to connect
$Cred = Get-Credential
$Url = Read-Host "Enter the SharePoint site URL"

#Setup client context object
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$Ctx.Credentials = $Cred

#Function to recurse through folders
Function ProcessFolder($Folder)
{
$Ctx.Load($Folder)
$Ctx.Load($Folder.Files)
$Ctx.Load($Folder.Folders)
$Ctx.ExecuteQuery()

#Update metadata for each file
Foreach($File in $Folder.Files)
{
$File.Item["Client"] = "Contoso Company"
$File.Item["Author"] = $File["Editor"]
$File.Item.Update()
}

#Recurse through subfolders
Foreach($SubFolder in $Folder.Folders)
{
ProcessFolder($SubFolder)
}
}

#Get root folder
$List = $Ctx.Web.Lists.GetByTitle("Documents")
$RootFolder = $List.RootFolder
ProcessFolder($RootFolder)

#Execute final changes
$Ctx.ExecuteQuery()

Write-host Updated metadata for $($RootFolder.Files.Count) files

Key Takeaways and Alternatives

Applying metadata to items uploaded via drag and drop in SharePoint requires some creativity in the short term. Manual options provide a bridge while more advanced scripting, flows, and custom code can provide robust long term solutions. As an alternative to these workarounds, using the SharePoint File Explorer integration allows direct uploads with metadata inheritance in the correct context.

Finally, while building custom solutions is an option, Often 3rd party tools exist from vendors like AvePoint, Quest, Metalogix, and others – that provide user friendly graphical interfaces to handle metadata application at scale across most SharePoint environments.

Leave a Reply

Your email address will not be published. Required fields are marked *