Share via

How do I re-use metadata from Word document on new tenant library?

Mads Lochmann Møller 0 Reputation points
2026-02-11T07:58:47.0366667+00:00

I am trying to download a Word document with associated metadata, which has also been inserted as quick parts within the document itself. I then upload the document to a document library in another tenant with exactly the same column names. Some of the metadata values are transferred correctly, while others are not.

Is there a way to carry out this process so that all metadata/properties from the Word document are imported correctly into the new library in the new tenant? This must be done without using a migration tool due to lack of permissions (policy restrictions).

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Steven-N 22,125 Reputation points Microsoft External Staff Moderator
    2026-02-11T08:46:56.3166667+00:00

    Hi Mads Lochmann Møller

    Thank you for reaching out to Microsoft Q&A forum support

    The reason why you get the behavior some of the metadata values are transferred correctly, while others are not likely stems from a mismatch in the internal Schema XML of the columns between the two tenants. Even if the display names are identical, SharePoint relies on internal GUIDs to map promoted properties.

    Since you cannot use migration tools that would typically handle this re-mapping, the most reliable workaround is a two-step process:

    1. Extract Metadata Locally: Use a client-side PowerShell script to read the custom properties directly from the Word files and export them to a CSV file.
    2. Bulk Update via Grid View: Upload the documents to the new library, then use the "Edit in grid view" feature in SharePoint to paste the metadata from your CSV file.

    You can use the following PowerShell script to extract the properties. Save this code as Extract-Metadata.ps1.

    param (
        [Parameter(Mandatory=$true)]
        [string]$SourcePath,
        [string]$OutputCsv = ".\DocumentMetadata.csv"
    )
    # Load required assembly for ZipFile
    Add-Type -AssemblyName System.IO.Compression.FileSystem
    $report = @()
    # Get all .docx files
    $files = Get-ChildItem -Path $SourcePath -Filter "*.docx" -Recurse
    foreach ($file in $files) {
        $zip = $null
        try {
            # Open the .docx file as a Zip archive
            $zip = [System.IO.Compression.ZipFile]::OpenRead($file.FullName)
            
            # Look for the custom file properties part
            $customPropsEntry = $zip.GetEntry("docProps/custom.xml")
            
            if ($customPropsEntry) {
                # Read the XML content
                $reader = New-Object System.IO.StreamReader($customPropsEntry.Open())
                $xmlContent = $reader.ReadToEnd()
                $reader.Close()
                
                # Parse XML
                [xml]$xml = $xmlContent
                
                # Create an object for the file
                $propsObject = [PSCustomObject]@{
                    FileName = $file.Name
                    FullPath = $file.FullName
                }
                
                # Extract properties
                # Namespace manager is needed for accurate parsing, but simple node iteration works for extraction
                foreach ($prop in $xml.Properties.ChildNodes) {
                    $name = $prop.name
                    # The value is usually in the first child node (e.g., vt:lpwstr, vt:i4)
                    $value = $prop.FirstChild.InnerText
                    
                    # Add property to the object
                    $propsObject | Add-Member -MemberType NoteProperty -Name $name -Value $value -Force
                }
                
                $report += $propsObject
            }
            else {
                Write-Warning "File $($file.Name) does not contain custom properties."
            }
        }
        catch {
            Write-Error "Failed to process $($file.Name): $_"
        }
        finally {
            if ($zip) { $zip.Dispose() }
        }
    }
    # Export to CSV
    # Note: Export-Csv uses the properties of the first object to define columns.
    # Ensure the first file processed has all expected properties, or pre-create a dummy file with all properties.
    if ($report.Count -gt 0) {
        $report | Export-Csv -Path $OutputCsv -NoTypeInformation
        Write-Host "Metadata extracted to $OutputCsv"
    }
    else {
        Write-Host "No custom properties found in the specified files."
    }
    
    

    You can follow the detail instructions:

    • Save the script above as Extract-Metadata.ps1.
    • Run the script in PowerShell, providing the folder path where your downloaded Word documents are located: .\Extract-Metadata.ps1 -SourcePath "C:\Path\To\MyDocuments"
    • Open the resulting DocumentMetadata.csv in Excel.

    Upload your Word documents to the new SharePoint library.

    In the SharePoint library, click Edit in grid view.

    Copy the metadata columns from your Excel CSV and paste them directly into the corresponding columns in the SharePoint grid view. This ensures all properties are populated correctly regardless of the internal schema mismatch.

    Hope my answer will help you.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  

    1 person found this answer helpful.

  2. Q&A Assist
    2026-02-11T07:59:29.2433333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To ensure that all metadata from a Word document is correctly imported into a new document library in a different tenant, you can follow these steps:

    1. Check Column Names: Ensure that the column names in the new tenant's document library exactly match those in the original library. Any discrepancies in naming can lead to metadata not being transferred.
    2. Use Document Information Panel: Before uploading the document, open it in Word and use the Document Information Panel to verify that all required metadata fields are filled out correctly. This panel can help you identify any missing or invalid properties that need to be addressed.
    3. Manual Entry: If certain metadata values do not transfer automatically, you may need to manually enter these values after uploading the document. This can be done by editing the properties of the document in the new library.
    4. Quick Parts: Since you mentioned using Quick Parts, ensure that the Quick Parts are correctly set up and that they correspond to the metadata fields in the new library. If the Quick Parts are not recognized, they may not populate the metadata fields as expected.
    5. Testing: Consider testing the upload process with a few documents to identify which metadata fields are not transferring correctly. This can help you troubleshoot and adjust your approach as needed.

    Unfortunately, without using a migration tool, there may be limitations on how metadata can be transferred, especially if permissions are restricted. If issues persist, consulting with your SharePoint administrator may provide additional insights or alternative solutions.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.