メインコンテンツにスキップ

PowerShell で Excel スプレッドシートを使用してメタデータをインポートする

注: PowerShell 統合には、ShareGate Migrate の Pro または Enterprise サブスクリプションが必要です。Essentials プランでは利用できません。

この記事では、ShareGate Migrate からエクスポートした Excel ファイルを使用して、移行中にメタデータを変更する方法について説明します。

Excel ファイルの詳細については、Excel または CSV を使用したメタデータのエクスポートとインポート、コピーを参照してください。

次のコマンドを使用して PowerShell で Excel スプレッドシートを利用することで、アイテムにカスタム メタデータを追加できます。

注: PowerShell を使用して Bulk edit content を実行することはできません。Excel スプレッドシートを使用してアイテムをその場で編集するには、Excel または CSV を使用したメタデータのエクスポートとインポート、コピーを参照して、ShareGate Migrate で直接操作を実行してください。

目次

Excel スプレッドシートを作成する

ファイルを作成するには、Excel または CSV を使用したメタデータのエクスポートとインポート、コピーの記事の手順 (1) から (8) に従います。

注: Excel スプレッドシートを PowerShell でエクスポートすることはできません。ShareGate Migrate で直接エクスポートする必要があります。

スクリプトを作成する

Excel メタデータ スプレッドシートを使用して移行を実行するには、コピー行で -ExcelFilePath を使用します。

Copy-Content を使用した例を次に示します。

Import-Module Sharegate

# Define source credentials
$srcUsername = "sourceusername"
$srcPassword = ConvertTo-SecureString 'sourcepassword' -AsPlainText -Force

# Define destination credentials
$dstUsername = "destinationusername"
$dstPassword = ConvertTo-SecureString 'destinationpassword' -AsPlainText -Force

# Connect to the source site
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" `
-Username $srcUsername `
-Password $srcPassword

# Connect to the destination site
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" `
-Username $dstUsername `
-Password $dstPassword

# Get the source list
$srcList = Get-List -Name "mysourcelist" `
-Site $srcSite

# Get the destination list
$dstList = Get-List -Name "mydestinationlist" `
-Site $dstSite

# Copy content from source list to destination list
Copy-Content -SourceList $srcList `
-DestinationList $dstList `
-ExcelFilePath "c:\Users\myUser\Desktop\myExcelFile.xslx"

スクリプトに関するガイドラインを次に示します。

  • $srcUsername、$srcPassword、$dstUsername、$dstPassword: "sourceusername"、'sourcepassword'、"destinationusername"、'destinationpassword' を、お使いの Microsoft 365 の資格情報に置き換えます。

  • Connect-Site: 認証方法を変更する必要がある場合は、Connect Siteの記事でその方法を確認できます。

  • $srcSite、$dstSite: URL をソース サイトとコピー先サイトに合わせて調整します。

  • $srcList、$dstList: "mysourcelist" と "mydestinationlist" を、ソース リストとコピー先リストの名前に置き換えます。

  • -ExcelFilePath: パスを Excel メタデータ ファイルの場所に合わせて調整します。このパラメーターは Copy-ContentImport-DocumentImport-GoogleDriveDocument で使用できます。

この記事はAIによって翻訳されています。ご不明な点がある場合は、英語の原文をご確認ください。

こちらの回答で解決しましたか?