This page explains how to add filters to your Microsoft SharePoint data stores in Gemini Enterprise. Filters determine which information is retrieved from the Microsoft SharePoint data source when users chat with the Assistant using the Gemini Enterprise app.
Before you begin
Ensure the following before you set up your Microsoft SharePoint federated connection:
Grant the Discovery Engine Editor role (
roles/discoveryengine.editor). This role is required for the user to create the data store. To grant this role, do the following:- In the Google Cloud console, go to the IAM page.
- Locate the user account and click the edit Edit icon.
- Grant the
Discovery Engine Editorrole to the user. For more information, see IAM roles and permissions.
Register Gemini Enterprise as an OAuth 2.0 application in Microsoft Entra ID and obtain the following credentials:
Client ID
Client secret
Tenant ID
Instance URI
Configure the Microsoft API permissions with the consent of a Microsoft SharePoint admin.
Create a data store with filters using the API
When creating a Microsoft SharePoint data store, you can add filters to retrieve
only specific data from the Microsoft SharePoint data source. You specify these
filters within the params object using the structured_search_filter field.
This field accepts an object containing key-value pairs. The keys represent the
SharePoint fields you want to filter on, and the values are arrays of strings
containing the criteria to match.
REST
To add filters when creating a data store, call the
setUpDataConnector
method with the structured_search_filter parameter:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-H "X-Goog-User-Project: PROJECT_ID" \
"https://ENDPOINT_LOCATION-discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/LOCATION:setUpDataConnector" \
-d '{
"collectionId": "COLLECTION_ID",
"collectionDisplayName": "COLLECTION_DISPLAY_NAME",
"dataConnector": {
"dataSource": "sharepoint_federated_search",
"params": {
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"instance_uri": "INSTANCE_URI",
"tenant_id": "TENANT_ID",
"structured_search_filter": {
"FILTER_KEY": [
"FILTER_VALUE1",
"FILTER_VALUE2"
]
}
},
"entities": [
{
"entityName": "file"
}
],
"refreshInterval": "7200s",
"connectorType": "THIRD_PARTY_FEDERATED",
"connectorModes": [
"FEDERATED"
]
}
}'
Replace the following:
-
PROJECT_ID: the ID of your project. -
ENDPOINT_LOCATION: the multi-region for your API request. Specify one of the following values:usfor the US multi-regioneufor the EU multi-regionglobalfor the Global location
-
LOCATION: the multi-region of your data store:global,us, oreu -
COLLECTION_ID: the unique ID of the data store. -
COLLECTION_DISPLAY_NAME: the display name of the data store. -
CLIENT_ID: the client ID for SharePoint authentication. -
CLIENT_SECRET: the client secret for SharePoint authentication. -
INSTANCE_URI: the instance URI for SharePoint. -
TENANT_ID: the tenant ID for SharePoint. -
FILTER_KEY: the key for the filter, corresponding to a field in your data. -
FILTER_VALUES: the value or values to filter on for the specifiedFILTER_KEY.
Add or update filters in an existing data store
To add filters to an existing data store or to update filters in an existing
Microsoft SharePoint data store, call the
updateDataConnector
method.
REST
To add or update filters in an existing SharePoint data store, run the following command:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-H "X-Goog-User-Project: PROJECT_ID" \
"https://ENDPOINT_LOCATION-discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/LOCATION/collections/COLLECTION_ID/dataConnector?updateMask=params" \
-d '{
"params": {
"structured_search_filter": {
"UPDATED_FILTER_KEY": [
"UPDATED_FILTER_VALUE1",
"UPDATED_FILTER_VALUE2"
]
}
}
}'
Replace the following:
-
PROJECT_ID: the ID of your project. -
ENDPOINT_LOCATION: the multi-region for your API request. Specify one of the following values:usfor the US multi-regioneufor the EU multi-regionglobalfor the Global location
-
LOCATION: the multi-region of your data store:global,us, oreu -
COLLECTION_ID: The ID of the collection containing the data store. -
UPDATED_FILTER_KEY: the key for the filter, corresponding to a field in your data. -
UPDATED_FILTER_VALUES: the value or values to filter on for the specifiedUPDATED_FILTER_KEY.
Verify that the data store includes the filters
You can get the details of the data store to confirm that the filters you added or updated are correctly applied using the following API method:
REST
To verify data store settings, call the
dataConnector.get
method:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "X-Goog-User-Project: PROJECT_ID" \
"https://ENDPOINT_LOCATION-discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/LOCATION/collections/COLLECTION_ID/dataConnector"
Replace the following:
-
PROJECT_ID: the ID of your project. -
ENDPOINT_LOCATION: the multi-region for your API request. Specify one of the following values:usfor the US multi-regioneufor the EU multi-regionglobalfor the Global location
-
LOCATION: the multi-region of your data store:global,us, oreu -
COLLECTION_ID: the ID of the collection containing the data store.
In the response, view the structured_search_filter field in params to verify
the filters.
What's next
- To provide a user interface for querying your Microsoft SharePoint data, create an app and connect it to the Microsoft SharePoint data store.
- To manage the list of actions, see Manage actions.
- To preview how your search results appear after your app is set up, see Get search results.
- To enable alerts for the data store, see Configure alerts for third-party data stores.