部署 Microsoft SharePoint Online 連接器

除了 Google Workspace 內容外,您還可以設定 Google Cloud Search,從貴機構的 SharePoint Online 內容傳回結果。您可使用並設定 Google Cloud Search SharePoint Online 連接器,讓連接器存取特定的 SharePoint Online 資料來源。

重要事項

Honored SharePoint 設定

Cloud Search SharePoint Online 連接器一律會遵循 SharePoint 的「搜尋瀏覽權限」設定 (無法覆寫)。針對草稿文件,使用者帳戶 (連接器用來存取 SharePoint Online) 的權限會決定哪些草稿文件要建立索引及傳回。如果帳戶只有「完整讀取」權限,連接器會遵循 SharePoint 的「草稿項目瀏覽權限」設定。

您還可以設定連接器,根據使用者帳戶存取權限限制結果。如要為 SharePoint 內容套用安全性剪輯功能,請將下列外部身分與 Google 目錄同步處理:

  • Office 365 / Azure AD 使用者
  • Office 365 / Azure AD 安全性群組
  • SharePoint 群組 (使用 Office 365 使用者和群組做為成員)

搜尋最佳化

您可以設定連接器以傳回更相關的搜尋結果,藉此改善使用者體驗。

如要使用 API,請在 SharePoint Online 連接器設定檔中設定 HTML 產生參數值。這些參數可讓您設定哪些欄位對於比對的影響較高或較低。

如要設定結構定義,請按照 建立及註冊結構定義一文的說明操作。設定結構定義時:

  • 如要將 SharePoint 內容類型的名稱對應至對應的物件定義,連接器會排除不支援的字元,將內容類型名稱正規化。針對物件定義,Cloud Search API 僅支援 A 至 Z、a 至 z 及 0 至 9 等有效字元。舉例來說,「公告」內容類型會對應至物件定義「公告」。「News Article」內容類型對應至「NewsArticle」(沒有空格)。

  • 當連接器無法比對物件定義與物件定義時,連接器會使用備用物件類型 (itemMetadata.objectType)。進一步瞭解中繼資料設定參數

  • 連接器會將 SharePoint 屬性名稱對應至屬性定義。

  • 當連接器為內容建立索引時遇到 Microsoft Outlook .msg 檔案時,就會覆寫檔案的內容類型,並將其索引為 application/vnd.ms-outlook.

已知連接器限制

  • 每個連接器執行個體只能為單一網站集合的內容建立索引。如要為多個網站集合建立索引,請設定其他連接器執行個體。
  • 隨著您在每個網站集合的 ACL 中使用的不重複使用者和群組數量,記憶體消耗量會隨之增加。
  • 刪除通知不會立即生效,連接器可能需要超過 4 小時才能識別使用者已從來源存放區刪除內容。

系統需求

系統需求
作業系統
  • Windows Server 2016
  • Ubuntu
  • Red Hat Enterprise Linux 5.0
  • SUSE Enterprise Linux 10 (64 位元)
驗證
  • 即時驗證
軟體
  • SharePoint Online 環境
  • 電腦上安裝了 Java JRE 1.8,可執行 Google Cloud Search SharePoint Online 連接器

部署連接器

必要條件

  1. 建立包含服務帳戶 ID 的 Google Workspace 私密金鑰。如要瞭解如何取得私密金鑰,請參閱 設定 Google Cloud Search API 存取權

  2. 您的 Google Workspace 管理員必須新增資料來源以進行搜尋。記錄資料來源 ID。

  3. 如果連接器根據 ACL 傳回結果 (結果並非公開),您的 Google Workspace 管理員就必須建立兩個識別資訊來源,並提供這些來源的 ID:

    • 一個用於 Office 365 使用者和群組
    • 一個用於 SharePoint 群組

    管理員也必須取得貴機構的 Google Workspace 客戶 ID,並提供給您。

    如要瞭解如何在 Cloud Search 中取得這些值,請參閱「在 Cloud Search 中對應使用者身分」一文。

  4. 為具有 SharePoint Online 網站集合管理員權限的連接器設定使用者帳戶。

  5. 如果連接器根據 ACL 傳回結果 (結果並非公開),請建立憑證,以便讀取您的 Office 365 帳戶中使用者和群組。按照 Microsoft 的操作說明建立 Azure Active Directory 應用程式。設定應用程式時:

    1. 使用描述性名稱命名應用程式,例如「gcs-o365-identity-connector」。
    2. 新增權限。應用程式需要「Group.Read.All」和「User.Read.All」。
    3. 記下下列資訊,以便在連接器設定中使用:
      • 應用程式 ID
      • 用戶群
      • 用戶端密鑰

步驟 1:安裝 SharePoint Online 連接器軟體

  1. 從 GitHub 複製連接器存放區。

    $ git clone https://github.com/google-cloudsearch/sharepoint-connector.git
    $ cd sharepoint-connector
  2. 查看所需連接器版本:

    $ git checkout tags/v1-0.0.3
  3. 建構連接器。

    $ mvn package

    如要在建立連接器時略過測試,請執行 mvn package -DskipTests,而不是 mvn package

  4. 將連接器 ZIP 檔案複製到本機安裝目錄:

    $ cp target/google-cloudsearch-sharepoint-connector-v1-0.0.3.zip installation-dir
    $ cd installation-dir
    $ unzip google-cloudsearch-sharepoint-connector-v1-0.0.3.zip
    $ cd google-cloudsearch-sharepoint-connector-v1-0.0.3

步驟 2:建立 SharePoint Online 連接器設定檔

  1. 在與連接器安裝相同的目錄中,建立新檔案並命名為 sharepoint-online-connector.config。如果您打算執行多個連接器執行個體,請在名稱中加入更多詳細資料以區別執行個體。

  2. 將參數做為鍵/值組合新增至檔案內容,如以下範例所示:

    ### SharePoint Online connector configuration ###
    
    # Required parameters for data source access
    api.sourceId=08ef8becd116faa4546b8ca2c84b2879
    api.serviceAccountPrivateKeyFile=service_account.json
    
    # Required parameters for SharePoint Online access
    sharepoint.server=https://mydomain.onmicrosoft.com
    sharepoint.siteCollectionOnly=true
    sharepoint.username=admin@mydomain.onmicrosoft.com
    sharepoint.password=pa$sw0rd
    sharepoint.formsAuthenticationMode=LIVE
    sharepoint.deploymentType=ONLINE
    
    # SharePoint identity mapping parameters
    api.identitySourceId=08ef8becd116faa475de26d9b291fed9
    api.referenceIdentitySources=defaultIdentitySource
    api.referenceIdentitySource.defaultIdentitySource.id=08ef8becd116faa5d3783f8c5a80e5aa
    
    # Optional SharePoint List Item metadata parameters
    contentTemplate.sharepointItem.title=Title
    contentTemplate.sharepointItem.unmappedColumnsMode=APPEND
    

    如需每個參數的詳細說明,請參閱 設定參數參考資料

  3. (選用) 視需要設定其他連接器參數。詳情請參閱 Google 提供的連接器參數

步驟 3:設定 SharePoint Online 連接器的記錄功能

  1. 在包含連接器二進位檔的目錄中,建立名為 logs 的資料夾。

  2. 在同一個目錄中建立名為 logging.properties 的 Latin-1 編碼檔案,並新增下列內容:

    handlers = java.util.logging.ConsoleHandler,java.util.logging.FileHandler
    # Default log level
    .level = INFO
    # uncomment line below to increase logging level for SharePoint APIsa
    #com.google.enterprise.cloudsearch.sharepoint.level=FINE
    
    # uncomment line below to increase logging level to enable API trace
    #com.google.api.client.http.level = FINE
    java.util.logging.ConsoleHandler.level = INFO
    java.util.logging.FileHandler.pattern=logs/connector-sharepoint.%g.log
    java.util.logging.FileHandler.limit=10485760
    java.util.logging.FileHandler.count=10
    java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
    

步驟 4:設定 SharePoint Online 識別資訊連接器

您必須執行這個步驟,才能將 SharePoint Online 身分式 ACL 套用到搜尋結果。如果是透過公開 ACL 設定連接器,可以略過這個步驟。

  1. 在安裝 SharePoint Online 連接器的目錄中,建立新檔案並命名為 sharepoint-online-identity-connector.config

  2. 將參數做為鍵/值組合新增至檔案內容,如以下範例所示:

    ### SharePoint Online identity connector configuration ###
    # Required parameters for data source access
    api.customerId=C05d3djk8
    api.serviceAccountPrivateKeyFile=service_account.json
    
    # Required parameters for SharePoint Online access
    sharepoint.server=https://mydomain.onmicrosoft.com
    sharepoint.siteCollectionOnly=true
    sharepoint.username=admin@mydomain.onmicrosoft.com
    sharepoint.password=pa$sw0rd
    sharepoint.formsAuthenticationMode=LIVE
    sharepoint.deploymentType=ONLINE
    
    # SharePoint identity mapping parameters
    api.identitySourceId=08ef8becd116faa475de26d9b291fed9
    api.referenceIdentitySources=defaultIdentitySource
    api.referenceIdentitySource.defaultIdentitySource.id=08ef8becd116faa5d3783f8c5a80e5aa
    

    此參數的值與 SharePoint Online 連接器的值幾乎相同,除了 api.sourceId 之外,參數為 api.customerIdapi.customerId 的值是您向 Google Workspace 管理員提供的客戶 ID。

步驟 5:安裝 Office 365 Identity 連接器

您必須執行這個步驟,才能將 SharePoint Online 身分式 ACL 套用到搜尋結果。如果是透過公開 ACL 設定連接器,可以略過這個步驟。

  1. 從 GitHub 複製連接器存放區。

    $ git clone https://github.com/google-cloudsearch/office-365-connector.git
    $ cd office-365-connector
  2. 查看所需連接器版本:

    $ git checkout tags/v1-0.0.3
  3. 建構連接器。

    $ mvn package

    如要在建立連接器時略過測試,請執行 mvn package -DskipTests,而不是 mvn package

  4. 將連接器 ZIP 檔案複製到本機安裝目錄:

    $ cp target/google-cloudsearch-office-365-connector-v1-0.0.3.zip installation-dir
    $ cd installation-dir
    $ unzip google-cloudsearch-office-365-connector-v1-0.0.3.zip
    $ cd google-cloudsearch-office-365-connector-v1-0.0.3

步驟 6:設定 Office 365 Identity 連接器並設定記錄功能

  1. 在安裝識別資訊連接器的同一個目錄中,建立新檔案並命名為 o365-identity-connector.config

  2. 將參數做為鍵/值組合新增至檔案內容,如以下範例所示。注意:所有參數均為必要參數,

    ### Office 365 Identity connector configuration ###
    api.identitySourceId=12345abcde api.customerId=abcde12345 o365.clientId=a63c6eb3-29e7-486 o365.tenant=185ef9ed-29e7-486 o365.clientSecret=raHJN15vRLBKs

    如需每個參數的詳細說明,請參閱 Office 365 Identity 連接器設定參考資料

  3. 在包含連接器二進位檔的目錄中,建立名為 logs 的資料夾。

  4. 在同一個目錄中建立名為 logging.properties 的 ASCII 或 UTF-8 檔案,並新增下列內容:

    handlers = java.util.logging.ConsoleHandler,java.util.logging.FileHandler
    # Default log level
    .level = INFO
    # uncomment line below to increase logging level for Office 365 APIs
    #com.google.enterprise.cloudsearch.o365.level=FINE
    
    # uncomment line below to increase logging level to enable Google API traces
    #com.google.api.client.http.level = FINE
    java.util.logging.ConsoleHandler.level = INFO
    java.util.logging.FileHandler.pattern=logs/connector-o365.%g.log
    java.util.logging.FileHandler.limit=10485760
    java.util.logging.FileHandler.count=10
    java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
    

步驟 7:啟動 SharePoint Online 連接器

在下列步驟中,您需要將 Office 365 和 SharePoint 網站集合中的主體對應到 Cloud Identity 服務中的身分。這項同步處理作業是透過 Office 365 身分識別連接器和 SharePoint Online 識別資訊連接器進行。

在 Office 365 連接器同步處理使用者和群組後,請執行 SharePoint Online 身分連接器,同步處理 SharePoint 網站集合群組。接著,請執行 SharePoint Online 連接器,為 Cloud Search 使用者建立索引並提供結果。

  1. 執行 Office 365 識別資訊連接器:

    $ java -Djava.util.logging.config.file=logging.properties -jar google-cloudsearch-office-365-connector-v1-0.0.3.jar -Dconfig=o365-identity-connector.config
  2. 執行 SharePoint Online 識別資訊連接器:

    $ java -Djava.util.logging.config.file=logging.properties -cp "google-cloudsearch-sharepoint-connector-v1-0.0.3.jar" com.google.enterprise.cloudsearch.sharepoint.SharePointIdentityConnector -Dconfig=sharepoint-online-identity-connector.config
  3. 執行 SharePoint Online 連接器:

    $ java -Djava.util.logging.config.file=logging.properties -jar google-cloudsearch-sharepoint-connector-v1-0.0.3.jar -Dconfig=sharepoint-online-connector.config

設定參數參考資料

資料來源存取權

設定 參數
資料來源 ID api.sourceId=1234567890abcdef

必要欄位。由 Google Workspace 管理員設定的 Google Cloud Search 資料來源 ID。

服務帳戶私密金鑰檔案的路徑 api.serviceAccountPrivateKeyFile=PrivateKey.json

必要欄位。Google Cloud Search 服務帳戶金鑰檔案的路徑。

SharePoint Online 存取權

設定 參數
SharePoint 網站集合的完整網域名稱 sharepoint.server=http://yoursharepoint.example.com/

必要欄位。如果網域名稱不是完整名稱,請在連接器主機上設定 DNS 覆寫。

僅限網站收集模式 sharepoint.siteCollectionOnly=true

必要欄位。如果是 SharePoint Online,請設定 true 值。

SharePoint 使用者名稱 sharepoint.username=username

必要欄位。用來存取 SharePoint Online 的帳戶使用者名稱。

SharePoint 密碼 sharepoint.password=user_password

必要欄位。用來存取 SharePoint Online 的帳戶密碼。

驗證模式 sharepoint.formsAuthenticationMode=LIVE

必要欄位。SharePoint Online 的值一律為 `LIVE`。

部署類型 sharepoint.deploymentType=ONLINE

必要欄位。SharePoint Online 的值一律為「ONLINE」。

SharePoint 識別資訊對應

設定 參數
識別資訊來源 ID api.identitySourceId=1234567890abcdef

必要欄位。SharePoint 群組識別資訊來源的 Cloud Search 識別資訊來源 ID。

參照識別資訊來源 api.referenceIdentitySources=defaultIdentitySource

必要欄位。針對 SharePoint Online,這個值一律為「defaultIdentitySource」。

參照識別資訊來源 ID api.referenceIdentitySource.defaultIdentitySource.id=112233abcd

必要欄位。Office 365 使用者和群組識別資訊來源的 Cloud Search 識別資訊來源 ID。

HTML 內容產生

設定 參數
HTML 範本標題欄位 contentTemplate.sharePointItem.title=Title

要用做所產生 HTML 的 HTML 範本標題的 SharePoint 欄位。

HTML 內容優質搜尋品質欄位 contentTemplate.sharePointItem.quality.high=highField1[,highField2,...]

要在產生的 HTML 中加入的欄位清單 (以半形逗號分隔),做為高品質欄位。當搜尋查詢與這些欄位相符時,結果的排名就會較高。

HTML 內容中等搜尋品質欄位 contentTemplate.sharePointItem.quality.medium=mediumField1[,mediumField2,...]

逗號分隔的欄位清單,要包含在產生的 HTML 中,做為中等品質欄位。

HTML 內容搜尋品質偏低的欄位 contentTemplate.sharePointItem.quality.low=lowField1[,lowField2,...]

要在產生的 HTML 中加入的欄位清單 (以半形逗號分隔),做為低品質欄位。

HTML 內容未對應的欄 contentTemplate.sharepointItem.unmappedColumnsMode=APPEND

連接器如何處理未對應的資料欄。值為 APPEND (預設) 或 IGNORE。

  • 附加:連接器會產生 HTML 內容,其中包含所有欄位,包括未設定品質等級 (高、中或低) 的欄位。
  • IGNORE - 連接器會產生僅有對應欄位的 HTML 內容。

Office 365 識別資訊連接器設定

設定 參數
識別資訊來源 ID api.identitySourceId=1234567890abcdef

必要欄位。Office 365 識別資訊來源 ID。這個值應與 SharePoint Online 連接器設定中的「api.referenceIdentitySource.defaultIdentitySource.id」值。

Google 客戶 ID api.customerId=c1b1d1e1

必要欄位。貴機構的 Google Workspace 客戶 ID。

Office 365 應用程式 ID o365.clientId=a63c6eb3-29e7-486

必要欄位。Office 365 應用程式設定的應用程式 ID。

Office 365 用戶群 o365.tenant=185ef9ed-29e7-486

必要欄位。Office 365 帳戶的租用戶 (Azure 活動目錄應用程式)

Office 365 用戶端密鑰 o365.clientSecret=raHJN15vRLBKs

必要欄位。設定 Office 365 應用程式設定的憑證密鑰