Skip to content

Commit 2c7432d

Browse files
Merge pull request SharePoint#9856 from SharePoint/tonchan-msft-searchcontentfix
Update search-content.md to include search by contaienr custom property scenario
2 parents 78290ae + 86f0c6e commit 2c7432d

File tree

1 file changed

+201
-4
lines changed

1 file changed

+201
-4
lines changed

docs/embedded/concepts/content-experiences/search-content.md

Lines changed: 201 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Search SharePoint Embedded containers and content
33
description: Overview on how to search SharePoint Embedded containers and content
4-
ms.date: 05/21/2024
4+
ms.date: 08/15/2024
55
ms.localizationpriority: high
66
---
77

@@ -12,7 +12,7 @@ Use the Microsoft Search API in Microsoft Graph to search SharePoint Embedded co
1212
> [!NOTE]
1313
>
1414
> 1. Search API only supports Delegated permissions.
15-
> 2. Your search requests must specify and set the `includeHiddenContent` parameter if your application has opted our from content discoverability in Microsoft 365. Learn more about [SharePoint Embedded content discoverability](./user-experiences-overview.md).
15+
> 1. Your search requests must specify and set the `includeHiddenContent` parameter if your application has opted out of content discoverability in Microsoft 365. Learn more about [SharePoint Embedded content discoverability](./user-experiences-overview.md).
1616
1717
## Example 1: Search containers by container type
1818

@@ -237,7 +237,7 @@ Content-type: application/json
237237

238238
## Example 4: Search for content by title in a specific container
239239

240-
This example queries all the content by a specific title in a specific container instance, with the SharePoint Embedded application opted out from content discoverability on Microsoft 365. The response includes all driveItems in the specific container instance that match the criteria.
240+
This example queries all the content by a specific title in a specific container instance, with the SharePoint Embedded application opted out from content discoverability on Microsoft 365. The response includes all `driveItems` in the specific container instance that match the criteria.
241241

242242
### Request
243243

@@ -336,7 +336,7 @@ Content-type: application/json
336336

337337
## Example 5: Search by content
338338

339-
This example queries all the content by the specified words across all containers of a specific container type, with the SharePoint Embedded application opted out from content discoverability on Microsoft 365. The response includes all driveItems that match the criteria.
339+
This example queries all the content by the specified words across all containers of a specific container type, with the SharePoint Embedded application opted out from content discoverability on Microsoft 365. The response includes all `driveItems` that match the criteria.
340340

341341
### Request
342342

@@ -431,6 +431,203 @@ Content-type: application/json
431431
]
432432
}
433433
```
434+
## Example 6: Search containers by container custom property
435+
436+
This example queries all containers by the specified custom property key:value pair, with the SharePoint Embedded applicatio that has opted out from content discoverability on Microsoft 365. The response includes all containers that match the criteria.
437+
438+
> [!NOTE]
439+
> The custom property name must be appended with the text "OWSTEXT" in the query string.
440+
441+
### Request
442+
443+
```HTTP
444+
POST /search/query
445+
Content-Type: application/json
446+
447+
{
448+
"requests": [
449+
{
450+
"entityTypes": [
451+
"drive"
452+
],
453+
"query": {
454+
"queryString": "customPropertyNametOWSTEXT:customPropertyValue AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
455+
},
456+
"sharePointOneDriveOptions": {
457+
"includeHiddenContent": true
458+
}
459+
}
460+
]
461+
}
462+
```
463+
464+
### Response
465+
466+
```HTTP
467+
HTTP/1.1 200 OK
468+
Content-type: application/json
469+
470+
{
471+
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
472+
"value": [
473+
{
474+
"searchTerms": [],
475+
"hitsContainers": [
476+
{
477+
"hits": [
478+
{
479+
"hitId": "b!C4Psl-ZZZkaZINVay8RKt2fqu3agJbVNlIUjNuIzqlPhOJMrr7ThS4aR8L8XdZu4",
480+
"rank": 1,
481+
"summary": "Everything about Contoso",
482+
"resource": {
483+
"@odata.type": "#microsoft.graph.drive",
484+
"id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
485+
"createdBy": {
486+
"user": {
487+
"displayName": "Dylan Williams"
488+
}
489+
},
490+
"lastModifiedDateTime": "2024-08-02T17:31:06Z",
491+
"name": "AllItems.aspx",
492+
"parentReference": {
493+
"sharepointIds": {
494+
"listId": "2b9338e1-b4af-4be1-8691-f0bf17759bb8"
495+
},
496+
"siteId": "contoso.sharepoint.com,97ec830b-59e6-4666-9920-d55acbc44ab7,76bbea67-25a0-4db5-9485-2336e233aa53"
497+
},
498+
"webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_97ec830b-59e6-4666-9920-d55acbc44ab7/Document Library/Forms/AllItems.aspx"
499+
}
500+
}
501+
],
502+
"total": 1,
503+
"moreResultsAvailable": false
504+
}
505+
]
506+
}
507+
]
508+
}
509+
```
510+
## Example 7: Search for content with specific content properties in response body
511+
512+
This example queries container content by specific words and requires the response to include all specified attributes on the content.
513+
514+
### Request
515+
516+
```HTTP
517+
POST /search/query
518+
Content-Type: application/json
519+
520+
{
521+
"requests": [
522+
{
523+
"entityTypes": [
524+
"driveItem"
525+
],
526+
"query": {
527+
"queryString": "Everything about contoso"
528+
},
529+
"sharePointOneDriveOptions": {
530+
"includeHiddenContent": true
531+
},
532+
"fields": [
533+
"SampleOWSText",
534+
"id",
535+
"name",
536+
"parentReference",
537+
"file",
538+
"folder",
539+
"webUrl",
540+
"createdDateTime",
541+
"lastModifiedDateTime",
542+
"size",
543+
"fileSystemInfo",
544+
"createdBy",
545+
"lastModifiedBy",
546+
"fileSystemInfo",
547+
"fileSystemInfo"
548+
]
549+
}
550+
]
551+
}
552+
```
553+
554+
### Response
555+
556+
```HTTP
557+
HTTP/1.1 200 OK
558+
Content-type: application/json
559+
560+
{
561+
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
562+
"value": [
563+
{
564+
"searchTerms": [
565+
"everything",
566+
"about",
567+
"contoso"
568+
],
569+
"hitsContainers": [
570+
{
571+
"hits": [
572+
{
573+
"hitId": "017JL52SWZQ2M5MULUKFBIL7SZ56EB4V2Z",
574+
"rank": 1,
575+
"summary": "Everything about Contoso",
576+
"resource": {
577+
"@odata.type": "#microsoft.graph.driveItem",
578+
"size": 17363,
579+
"fileSystemInfo": {
580+
"createdDateTime": "2024-06-20T21:49:03Z",
581+
"lastModifiedDateTime": "2024-04-01T16:57:00Z"
582+
},
583+
"listItem": {
584+
"@odata.type": "#microsoft.graph.listItem",
585+
"id": "d69986d9-7451-4251-85fe-59ef881e5759",
586+
"fields": {
587+
"sampleOWSText": "Sample Value",
588+
"id": "AAAAAH_MwHAjYctMtjgTN1cWJnYHAApvY20ubJFGtzLui9sETKcAAAAAASsAAApvY20ubJFGtzLui9sETKcAAAAAJqsAAA2",
589+
"size": 17363,
590+
"createdBy": "Dylan Williams"
591+
}
592+
},
593+
"id": "017JL52SWZQ2M5MULUKFBIL7SZ56EB4V2Z",
594+
"createdBy": {
595+
"user": {
596+
"displayName": "Dylan Williams",
597+
"email": "[email protected]"
598+
}
599+
},
600+
"createdDateTime": "2024-06-20T21:49:03Z",
601+
"lastModifiedBy": {
602+
"user": {
603+
"displayName": "Dylan Williams",
604+
"email": "[email protected]"
605+
}
606+
},
607+
"lastModifiedDateTime": "2024-04-01T16:57:00Z",
608+
"name": "Constoso Details.docx",
609+
"parentReference": {
610+
"driveId": "b!rWzsZXXFWEOeeP31bSE5BTjn_6qC3dFNloUBMv62EMilewHuRwQrQau-zcJu2BT0",
611+
"id": "017JL52SXQSKBKPB7VKZCJE5ZSWUN4LZDZ",
612+
"sharepointIds": {
613+
"listId": "ee017ba5-0447-412b-abbe-cdc26ed814f4",
614+
"listItemId": "1",
615+
"listItemUniqueId": "d69986d9-7451-4251-85fe-59ef881e5759"
616+
},
617+
"siteId": "contoso.sharepoint.com,65ec6cad-c575-4358-9e78-fdf56d213905,aaffe738-dd82-4dd1-9685-0132feb610c8"
618+
},
619+
"webUrl": "https://contoso.sharepointt.com/contentstorage/CSP_65ec6cad-c575-4358-9e78-fdf56d213905/Document Library/Constoso Details.docx"
620+
}
621+
}
622+
],
623+
"total": 1,
624+
"moreResultsAvailable": false
625+
}
626+
]
627+
}
628+
]
629+
}
630+
```
434631

435632
## Known Limitation
436633

0 commit comments

Comments
 (0)