対象となるコレクションのコンテンツ検索を使用する

Microsoft Purview コンプライアンス ポータルのコンテンツ検索ツールでは、EXCHANGE メールボックスまたは SharePoint および OneDrive for Business サイト内の特定のフォルダーを検索するための UI の直接的な方法は提供されません。 ただし、実際の検索クエリ構文でサイトの電子メールまたはパス (DocumentLink) プロパティのフォルダー ID プロパティを指定することで、特定のフォルダー ( ターゲット コレクションと呼ばれます) を検索できます。 コンテンツ検索を使用して対象のコレクションを実行すると、ケースまたは特権アイテムに対応するアイテムが特定のメールボックスまたはサイト フォルダーに配置されていると確信できる場合に便利です。

この記事のスクリプトを使用して、メールボックス フォルダーのフォルダー ID、または SharePoint および OneDrive for Business サイト上のフォルダーのパス (DocumentLink) を取得できます。 その後、検索クエリのフォルダー ID またはパスを使用して、フォルダー内にある項目を返すことができます。

注:

SharePoint または OneDrive for Business サイト内のフォルダーにあるコンテンツを返すために、このトピックのスクリプトでは、Path プロパティではなく DocumentLink 管理プロパティを使用します。 DocumentLink プロパティは、フォルダー内のすべてのコンテンツを返すのに対し、Path プロパティは一部のメディア ファイルを返さないため、Path プロパティよりも堅牢です。

ヒント

E5 のお客様でない場合は、90 日間の Microsoft Purview ソリューション試用版を使用して、Purview の追加機能が組織のデータ セキュリティとコンプライアンスのニーズの管理にどのように役立つかを確認してください。 Microsoft Purview コンプライアンス ポータルのトライアル ハブで今すぐ開始してください。 サインアップと試用期間の詳細については、こちらをご覧ください。

対象のコレクションを実行する前に

  • 手順 1 でスクリプトを実行するには、コンプライアンス ポータルの電子情報開示マネージャー役割グループのメンバーである必要があります。 詳細については、「電子情報開示のアクセス許可を割り当てる」を参照してください。電子情報開示のアクセス許可を割り当てる」を参照してください。

  • また、Exchange Online organizationでメール受信者ロールを割り当てる必要があります。 これは、スクリプトに含まれる Get-MailboxFolderStatistics コマンドレットを実行するために必要です。 既定では、メール受信者ロールは、Exchange Onlineの組織の管理と受信者管理の役割グループに割り当てられます。 Exchange Onlineでのアクセス許可の割り当ての詳細については、「ロール グループ メンバーの管理」を参照してください。 カスタム ロール グループを作成し、メール受信者ロールを割り当ててから、手順 1 でスクリプトを実行する必要があるメンバーを追加することもできます。 詳細については、「 役割グループの管理」を参照してください。

  • この記事のスクリプトでは、先進認証がサポートされています。 Microsoft 365 または Microsoft 365 GCC organizationの場合は、そのままスクリプトを使用できます。 ドイツorganization Office 365、Microsoft 365 GCC High organization、または Microsoft 365 DoD organizationの場合は、スクリプトを編集して正常に実行する必要があります。 具体的には、行Connect-ExchangeOnlineを編集し、ExchangeEnvironmentName パラメーター (およびorganizationの種類に適した値) を使用して、powerShell Exchange Online接続する必要があります。 また、行Connect-IPPSSessionを編集し、ConnectionUri パラメーターと AzureADAuthorizationEndpointUri パラメーター (およびorganizationの種類に適した値) を使用して、Security & Compliance PowerShell に接続する必要があります。 詳細については、「PowerShell に接続する」および「セキュリティに接続する &コンプライアンス PowerShell」の例Exchange Online参照してください。

  • スクリプト内のフォルダー ID は、16 進 (HEX) 値の形式である必要があります。

  • スクリプトを実行するたびに、新しいリモート PowerShell セッションが作成されます。 つまり、使用可能なすべてのリモート PowerShell セッションを使用できます。 これを回避するには、次のコマンドを実行して、アクティブなリモート PowerShell セッションを切断します。

    Get-PSSession | Remove-PSSession; Disconnect-ExchangeOnline
    

    詳細については、「Exchange Online PowerShell への接続」を参照してください。

  • スクリプトには、最小限のエラー処理が含まれています。 スクリプトの主な目的は、対象のコレクションを実行するためにコンテンツ検索の検索クエリ構文で使用できるメールボックス フォルダー ID またはサイト パスの一覧をすばやく表示することです。

  • この記事で提供されるサンプル スクリプトは、Microsoft のいかなる標準サポート プログラムまたはサービスの下でもサポートされません。 サンプル スクリプトは現状のまま提供され、いかなる保証も伴いません。 さらに、Microsoft は、商品性、特定目的への適合性の黙示の保証を含む、一切の黙示の保証をいたしかねます。 本サンプル スクリプトおよびドキュメントの使用または性能に起因するすべてのリスクは、お客様が負うものとします。 サンプル スクリプトおよびドキュメントを使用したこと、または使用できなかったことに伴って生じるいかなる損害 (業務利益の損失、業務の中断、業務情報の損失、金銭上の損失、その他一切の損害) についても、Microsoft、Microsoft に帰属する作者、スクリプトの作成、製造、または納入に関与したその他のすべての人員は、いかなる場合も責めを負わないものとします。

手順 1: スクリプトを実行して、メールボックスまたはサイトのフォルダーの一覧を取得する

この最初の手順で実行するスクリプトは、メールボックス フォルダーまたは SharePoint フォルダーとOneDrive for Business フォルダーの一覧と、各フォルダーの対応するフォルダー ID またはパスを返します。 このスクリプトを実行すると、次の情報の入力を求められます。

  • Emailアドレスまたはサイト URL: カストディアンのメール アドレスを入力して、Exchange メールボックス フォルダーとフォルダー ID の一覧を返します。 または、SharePoint サイトまたはOneDrive for Business サイトの URL を入力して、指定したサイトのパスの一覧を返します。 次に、いくつかの例を示します:

    • Exchange: stacig@contoso.onmicrosoft.com
    • SharePoint: https://contoso.sharepoint.com/sites/marketing
    • OneDrive for Business:https://contoso-my.sharepoint.com/personal/stacig_contoso_onmicrosoft_com
  • ユーザーの資格情報: スクリプトは資格情報を使用して、先進認証を使用して PowerShell またはセキュリティ & コンプライアンス PowerShell Exchange Onlineに接続します。 前に説明したように、このスクリプトを正常に実行するには、適切なアクセス許可を割り当てる必要があります。

メールボックス フォルダーまたはサイト ドキュメントリンク (パス) 名の一覧を表示するには:

  1. .ps1 のファイル名サフィックスを使用して、次のテキストをWindows PowerShellスクリプト ファイルに保存します。例: GetFolderSearchParameters.ps1

    #########################################################################################################
    # This PowerShell script will prompt you for:                                #
    #    * Admin credentials for a user who can run the Get-MailboxFolderStatistics cmdlet in Exchange    #
    #      Online and who is an eDiscovery Manager in the compliance portal.            #
    # The script will then:                                            #
    #    * If an email address is supplied: list the folders for the target mailbox.            #
    #    * If a SharePoint or OneDrive for Business site is supplied: list the documentlinks (folder paths) #
    #    * for the site.                                                                                    #
    #    * In both cases, the script supplies the correct search properties (folderid: or documentlink:)    #
    #      appended to the folder ID or documentlink to use in a Content Search.                #
    # Notes:                                                #
    #    * For SharePoint and OneDrive for Business, the paths are searched recursively; this means the     #
    #      the current folder and all sub-folders are searched.                        #
    #    * For Exchange, only the specified folder will be searched; this means sub-folders in the folder    #
    #      will not be searched.  To search sub-folders, you need to use the specify the folder ID for    #
    #      each sub-folder that you want to search.                                #
    #    * For Exchange, only folders in the user's primary mailbox will be returned by the script.        #
    #########################################################################################################
    # Collect the target email address or SharePoint Url
    $addressOrSite = Read-Host "Enter an email address or a URL for a SharePoint or OneDrive for Business site"
    # Authenticate with Exchange Online and the compliance portal (Exchange Online Protection - EOP)
    if ($addressOrSite.IndexOf("@") -ige 0)
    {
       # List the folder Ids for the target mailbox
       $emailAddress = $addressOrSite
       # Connect to Exchange Online PowerShell
       if (!$ExoSession)
       {
           Import-Module ExchangeOnlineManagement
           Connect-ExchangeOnline -ShowBanner:$false -CommandName Get-MailboxFolderStatistics
       }
       $folderQueries = @()
       $folderStatistics = Get-MailboxFolderStatistics $emailAddress
       foreach ($folderStatistic in $folderStatistics)
       {
           $folderId = $folderStatistic.FolderId;
           $folderPath = $folderStatistic.FolderPath;
           $encoding= [System.Text.Encoding]::GetEncoding("us-ascii")
           $nibbler= $encoding.GetBytes("0123456789ABCDEF");
           $folderIdBytes = [Convert]::FromBase64String($folderId);
           $indexIdBytes = New-Object byte[] 48;
           $indexIdIdx=0;
           $folderIdBytes | select -skip 23 -First 24 | %{$indexIdBytes[$indexIdIdx++]=$nibbler[$_ -shr 4];$indexIdBytes[$indexIdIdx++]=$nibbler[$_ -band 0xF]}
           $folderQuery = "folderid:$($encoding.GetString($indexIdBytes))";
           $folderStat = New-Object PSObject
           Add-Member -InputObject $folderStat -MemberType NoteProperty -Name FolderPath -Value $folderPath
           Add-Member -InputObject $folderStat -MemberType NoteProperty -Name FolderQuery -Value $folderQuery
           $folderQueries += $folderStat
       }
       Write-Host "-----Exchange Folders-----"
       $folderQueries |ft
    }
    elseif ($addressOrSite.IndexOf("http") -ige 0)
    {
       $searchName = "SPFoldersSearch"
       $searchActionName = "SPFoldersSearch_Preview"
       $rawUrls = @()
       # List the folders for the SharePoint or OneDrive for Business Site
       $siteUrl = $addressOrSite
       # Connect to Security & Compliance PowerShell
       if (!$SccSession)
       {
           Import-Module ExchangeOnlineManagement
           Connect-IPPSSession
       }
       # Clean-up, if the script was aborted, the search we created might not have been deleted.  Try to do so now.
       Remove-ComplianceSearch $searchName -Confirm:$false -ErrorAction 'SilentlyContinue'
       # Create a Content Search against the SharePoint Site or OneDrive for Business site and only search for folders; wait for the search to complete
       $complianceSearch = New-ComplianceSearch -Name $searchName -ContentMatchQuery "contenttype:folder OR contentclass:STS_Web" -SharePointLocation $siteUrl
       Start-ComplianceSearch $searchName
       do{
           Write-host "Waiting for search to complete..."
           Start-Sleep -s 5
           $complianceSearch = Get-ComplianceSearch $searchName
       }while ($complianceSearch.Status -ne 'Completed')
       if ($complianceSearch.Items -gt 0)
       {
           # Create a Compliance Search Action and wait for it to complete. The folders will be listed in the .Results parameter
           $complianceSearchAction = New-ComplianceSearchAction -SearchName $searchName -Preview
           do
           {
               Write-host "Waiting for search action to complete..."
               Start-Sleep -s 5
               $complianceSearchAction = Get-ComplianceSearchAction $searchActionName
           }while ($complianceSearchAction.Status -ne 'Completed')
           # Get the results and print out the folders
           $results = $complianceSearchAction.Results
           $matches = Select-String "Data Link:.+[,}]" -Input $results -AllMatches
           foreach ($match in $matches.Matches)
           {
               $rawUrl = $match.Value
               $rawUrl = $rawUrl -replace "Data Link: " -replace "," -replace "}"
               $rawUrls += "DocumentLink:""$rawUrl"""
           }
           $rawUrls |ft
       }
       else
       {
           Write-Host "No folders were found for $siteUrl"
       }
       Remove-ComplianceSearch $searchName -Confirm:$false -ErrorAction 'SilentlyContinue'
    }
    else
    {
       Write-Error "Couldn't recognize $addressOrSite as an email address or a site URL"
    }
    
  2. ローカル コンピューターで、Windows PowerShellを開き、スクリプトを保存したフォルダーに移動します。

  3. スクリプトを実行します。例えば:

    .\GetFolderSearchParameters.ps1
    
  4. スクリプトで求める情報を入力します。

    スクリプトには、指定したユーザーのメールボックス フォルダーまたはサイト フォルダーの一覧が表示されます。 フォルダー ID またはドキュメントリンク名をコピーし、手順 2. で検索クエリに貼り付けることができるように、このウィンドウは開いたままにします。

    ヒント

    コンピューター画面にフォルダーの一覧を表示する代わりに、スクリプトの出力をテキスト ファイルに再転送できます。 このファイルは、スクリプトが配置されているフォルダーに保存されます。 たとえば、スクリプト出力をテキスト ファイルにリダイレクトするには、「手順 3: .\GetFolderSearchParameters.ps1 > StacigFolderIds.txt 検索クエリで使用するフォルダー ID またはドキュメントリンクをファイルからコピーする」で次のコマンドを実行します。

メールボックス フォルダーのスクリプト出力

メールボックス フォルダー ID を取得している場合、スクリプトは PowerShell Exchange Onlineに接続し、Get-MailboxFolderStatisics コマンドレットを実行して、指定したメールボックスのフォルダーの一覧を表示します。 メールボックス内のすべてのフォルダーについて、スクリプトには FolderPath 列のフォルダーの名前と FolderQuery 列のフォルダー ID が表示されます。 さらに、スクリプトは folderId のプレフィックス (メールボックス プロパティの名前) をフォルダー ID に追加します。 folderid プロパティは検索可能なプロパティであるため、folderid:<folderid>手順 2 の検索クエリでそのフォルダーを検索します。

重要

この記事のスクリプトには、 Get-MailboxFolderStatistics によって返される 64 文字のフォルダー ID 値を、検索用にインデックスが作成されたのと同じ 48 文字形式に変換するエンコード ロジックが含まれています。 PowerShell で Get-MailboxFolderStatistics コマンドレットを実行して (この記事のスクリプトを実行するのではなく) フォルダー ID を取得するだけの場合、そのフォルダー ID 値を使用する検索クエリは失敗します。 コンテンツ検索で使用できる正しい形式のフォルダー ID を取得するには、スクリプトを実行する必要があります。

メールボックス フォルダーのスクリプトによって返される出力の例を次に示します。

スクリプトによって返されるメールボックス フォルダーとフォルダー ID の一覧の例。

手順 2 の例は、ユーザーの回復可能なアイテム フォルダー内の Purges サブフォルダーを検索するために使用されるクエリを示しています。

サイト フォルダーのスクリプト出力

SharePoint または OneDrive for Business サイトから documentlink プロパティのパスを取得している場合、スクリプトは Security & Compliance PowerShell に接続し、サイトでフォルダーを検索する新しいコンテンツ検索を作成し、指定したサイトにあるフォルダーの一覧を表示します。 このスクリプトは、各フォルダーの名前を表示し、 documentlink のプレフィックスをフォルダー URL に追加します。 documentlink プロパティは検索可能なプロパティであるため、手順 2 の検索クエリで property:value ペアを使用documentlink:<path>してそのフォルダーを検索します。 スクリプトには、最大 100 個のサイト フォルダーが表示されます。 サイト フォルダーが 100 を超える場合は、最新のフォルダーが表示されます。

サイト フォルダーのスクリプトによって返される出力の例を次に示します。

スクリプトによって返されるサイト フォルダーのドキュメントリンク名の一覧の例。

複数のメールボックスから FolderID をプルするスクリプト

Excel で FolderID 変換の結果をグループ化して並べ替える必要がある場合は、次の手順を実行して、個々のユーザーに対して複数の削除されたフォルダーを表示できるようにします。

  1. UsersSMTP の列見出しを持つという名前UsersGatherFolderIDsの .csv ファイルを作成します。

  2. フォルダー クエリ構文に変換するメールボックス フォルダーのこの列の行にユーザーのメール アドレスを入力します。

  3. .ps1 のファイル名サフィックスを使用して、次のテキストをWindows PowerShellスクリプト ファイルに保存します。たとえば、GetMultiUserFolderIDseDiscovery.ps1

     #########################################################################################################
     #This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 
     #THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS OR A PARTICULAR PURPOSE. 
     #We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, provided that You agree: 
     # (1) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 
     # (2) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 
     # (3) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, including attorney's fees, that arise or result from the use or distribution of the Sample Code.
     #########################################################################################################
     " "
     write-host "***********************************************"
     write-host "Security & Compliance Center   " -foregroundColor yellow -backgroundcolor darkgreen
     write-host "eDiscovery cases - FolderID report         " -foregroundColor yellow -backgroundcolor darkgreen
     write-host "***********************************************"
     " "
    
     #prompt users to specify a path to store the output files
     $time = get-date -Format dd-MM-yyyy_hh.mm
     $Path = Read-Host 'Enter a folder path to save the report to a .csv file (filename is created automatically).'
     $inputPath = $Path + '\' + 'Users_GatherFolderID.csv'
     $outputpath = $Path + '\' + 'FileID Report' + ' ' + $time + '.csv'
    
     #Imports list of users
     #User List needs column "UserSMTP" with values of each mailbox's SMTP address.
     $users = Import-CSV $inputPath
    
     function add-tofolderidreport {
         Param(
             [string]$UserEmail,
             [String]$FolderName,
             [String]$FolderID,
             [String]$ConvertedFolderQuery
         )
    
         $addRow = New-Object PSObject
         Add-Member -InputObject $addRow -MemberType NoteProperty -Name "User Email" -Value $useremail
         Add-Member -InputObject $addRow -MemberType NoteProperty -Name "Folder Name" -Value $FolderName
         Add-Member -InputObject $addRow -MemberType NoteProperty -Name "Native Folder ID" -Value $FolderID
         Add-Member -InputObject $addRow -MemberType NoteProperty -Name "Converted Folder Query" -Value $ConvertedFolderQuery
    
         $folderIDReport = $addRow | Select-Object "User Email", "Folder Name", "Native Folder ID", "Converted Folder Query"
         $folderIDReport | export-csv -path $outputPath -notypeinfo -append -Encoding ascii
     }
    
     #get information on the cases and pass values to the FolderID report function
     foreach ($u in $users) {
         $userAddress = $u.UserSMTP
         " "
         write-host "Gathering list of Folders for User:" $userAddress -ForegroundColor Yellow -BackgroundColor Black
         " "
         if ($userAddress.IndexOf("@") -ige 0) {
             # List the folder Ids for the target mailbox
             $emailAddress = $userAddress
             # Connect to Exchange Online PowerShell
             $folderQueries = @()
             $folderStatistics = Get-MailboxFolderStatistics $emailAddress -IncludeSoftDeletedRecipients
             foreach ($folderStatistic in $folderStatistics) {
                 $folderId = $folderStatistic.FolderId;
                 $folderPath = $folderStatistic.FolderPath;
                 $encoding = [System.Text.Encoding]::GetEncoding("us-ascii")
                 $nibbler = $encoding.GetBytes("0123456789ABCDEF");
                 $folderIdBytes = [Convert]::FromBase64String($folderId);
                 $indexIdBytes = New-Object byte[] 48;
                 $indexIdIdx = 0;
                 $folderIdBytes | select -skip 23 -First 24 | % { $indexIdBytes[$indexIdIdx++] = $nibbler[$_ -shr 4]; $indexIdBytes[$indexIdIdx++] = $nibbler[$_ -band 0xF] }
                 $folderQuery = "folderid:$($encoding.GetString($indexIdBytes))";
                 $folderStat = New-Object PSObject
                 Add-Member -InputObject $folderStat -MemberType NoteProperty -Name FolderPath -Value $folderPath
                 Add-Member -InputObject $folderStat -MemberType NoteProperty -Name FolderQuery -Value $folderQuery
                 $folderQueries += $folderStat
    
                 #add information to Report
                 add-tofolderidreport -UserEmail $emailAddress -FolderName $folderPath -FolderID $folderId -ConvertedFolderQuery $folderQuery
             }
    
             #Outputs Exchange Folders for Single User
             Write-Host "-----Exchange Folders-----" -ForegroundColor Yellow
             $folderQueries | ft
    
         }
    
     }
    
     #Provides Path of Report
     " "
     Write-Host "----- Report Output Available at:" "$outputpath" " -----" -ForegroundColor Yellow -BackgroundColor Cyan
     " "
    
  4. ローカル コンピューターで、Windows PowerShellを開き、スクリプトを保存したフォルダーに移動します。 スクリプト ファイル GetMultiUserFolderIDseDiscovery.ps1を実行します。

  5. UsersGatherFolderIDs.csv ファイルを保存したフォルダー パスを入力します。

  6. スクリプトには、指定したユーザーのメールボックス フォルダーまたはサイト フォルダーの一覧が表示されます。 また、手順 4 で指定したのと同じルート フォルダーにレポートを作成します。

スクリプトを実行して特定のユーザーのフォルダー ID またはドキュメント リンクの一覧を収集したら、次の手順でコンプライアンス ポータルに移動し、新しいコンテンツ検索を作成して特定のフォルダーを検索します。 [コンテンツ検索] folderid:<folderid> キーワード (keyword) ボックスで構成する検索クエリで、or documentlink:<path> property:value ペアを使用します (New-ComplianceSearch コマンドレットを使用する場合は ContentMatchQuery パラメーターの値として使用します)。 または documentlink プロパティを他のfolderid検索パラメーターまたは検索条件と組み合わせることができます。 クエリに または documentlink プロパティのみを含めるfolderid場合、指定したフォルダーにあるすべての項目が検索によって返されます。

  1. https://compliance.microsoft.comに移動し、手順 1 でスクリプトを実行するために使用したアカウントと資格情報を使用してサインインします。

  2. コンプライアンス ポータルの左側のウィンドウで、[ すべての>コンテンツ検索を表示] を選択し、[ 新しい検索] を選択します。

  3. [ キーワード ] ボックスに folderid:<folderid> 、手順 1 でスクリプトによって返された値または documentlink:<path>/* 値を貼り付けます。

    たとえば、次のスクリーンショットのクエリでは、ユーザーの回復可能なアイテム フォルダー内の Purges サブフォルダー内のアイテムを検索します (Purges サブフォルダーのプロパティの folderid 値は、手順 1 のスクリーンショットに示されています)。

    folderid または documentlink を検索クエリのキーワード (keyword) ボックスに貼り付けます。

    重要

    documentlink 検索では、末尾 asterisk '/*'に を使用する必要があります。

  4. [ 場所] で [ 特定の場所 ] を選択し、[ 変更] を選択します。

  5. メールボックス フォルダーとサイト フォルダーのどちらを検索しているかに基づいて、次のいずれかの操作を行います。

    • [Exchange メール] の横にある [ユーザー、グループ、またはチームの選択] を選択し、手順 1 でスクリプトを実行したときに指定したのと同じメールボックスを追加します。

      または

    • [SharePoint サイト] の横にある [サイトの選択] を選択し、手順 1 でスクリプトを実行したときに指定したのと同じサイト URL を追加します。

  6. 検索するコンテンツの場所を保存した後、[ 実行 & 保存] を選択し、コンテンツ検索の名前を入力し、[ 保存 ] を選択して対象のコレクション検索を開始します。

対象となるコレクションの検索クエリの例

検索クエリで および documentlink プロパティを使用してfolderid対象のコレクションを実行する例を次に示します。 プレースホルダーは、 と documentlink:<path>folderid:<folderid>使用され、領域を節約します。

  • 次の使用例は、3 つの異なるメールボックス フォルダーを検索します。 同様のクエリ構文を使用して、ユーザーの回復可能なアイテム フォルダー内の非表示のフォルダーを検索できます。

    folderid:<folderid> OR folderid:<folderid> OR folderid:<folderid>
    
  • 次の使用例は、正確な語句を含むアイテムをメールボックス フォルダーで検索します。

    folderid:<folderid> AND "Contoso financial results"
    
  • 次の使用例は、サイト フォルダー (およびサブフォルダー) で、タイトルに "NDA" という文字が含まれているドキュメントを検索します。

    documentlink:"<path>/*" AND filename:nda
    
  • 次の使用例は、サイト フォルダー (および任意のサブフォルダー) で、日付範囲内で変更されたドキュメントを検索します。

    documentlink:"<path>/*" AND (lastmodifiedtime>=01/01/2017 AND lastmodifiedtime<=01/21/2017)
    

詳細

この記事のスクリプトを使用して対象のコレクションを実行する場合は、次の点に注意してください。

  • スクリプトは結果からフォルダーを削除しません。 そのため、結果に一覧表示されている一部のフォルダーは、システム生成コンテンツが含まれているか、サブフォルダーのみが含まれており、メールボックスアイテムは含まれていないため、検索できない (または 0 個のアイテムが返される) 可能性があります。
  • このスクリプトは、ユーザーのプライマリ メールボックスのフォルダー情報のみを返します。 ユーザーのアーカイブ メールボックス内のフォルダーに関する情報は返されません。 ユーザーのアーカイブ メールボックス内のフォルダーに関する情報を返すには、スクリプトを編集できます。 これを行うには、行 $folderStatistics = Get-MailboxFolderStatistics $emailAddress を に $folderStatistics = Get-MailboxFolderStatistics $emailAddress -Archive 変更し、編集したスクリプトを保存して実行します。 この変更により、ユーザーのアーカイブ メールボックス内のフォルダーとサブフォルダーのフォルダー ID が返されます。 アーカイブ メールボックス全体を検索するには、すべてのフォルダー ID プロパティと値のペアを OR 検索クエリの演算子に接続します。
  • メールボックス フォルダーを検索する場合、指定したフォルダー (プロパティ folderid で識別) のみが検索されます。サブフォルダーは検索されません。 サブフォルダーを検索するには、検索するサブフォルダーのフォルダー ID を使用する必要があります。
  • サイト フォルダーを検索すると、フォルダー (プロパティ documentlink で識別) とすべてのサブフォルダーが検索されます。
  • 検索クエリでプロパティのみを指定した folderid 検索の結果をエクスポートする場合は、最初のエクスポート オプション "認識されない形式のアイテムを除くすべてのアイテムが暗号化されているか、他の理由でインデックスが作成されなかった" を選択できます。フォルダー ID は常にインデックスが作成されるため、フォルダー内のすべてのアイテムは、インデックス作成の状態に関係なく常にエクスポートされます。