Partager via


Rechercher du contenu SharePoint Embedded

Utilisez l’API Recherche Microsoft dans Microsoft Graph pour rechercher du contenu et des conteneurs SharePoint Embedded. L’API de recherche vous permet d’étendre le type de conteneur et le type de fichier pour vos requêtes en spécifiant le paramètre correspondant dans le corps de la requête. Cet article décrit quelques exemples.

Remarque

  1. La recherche de contenu SharePoint Embedded est en préversion et est susceptible d’être modifiée. Reportez-vous au modèle d’accès exceptionnel qui décrit ses exigences d’autorisation actuelles.
  2. L’API de recherche prend uniquement en charge les autorisations déléguées.
  3. Vos demandes de recherche doivent spécifier et définir le includeHiddenContent paramètre si votre application a refusé la détectabilité du contenu dans Microsoft 365. En savoir plus sur la détectabilité du contenu SharePoint Embedded.

Exemple 1 : Rechercher des conteneurs par type de conteneur

Cet exemple interroge tous les conteneurs selon le type de conteneur spécifié avec l’application SharePoint Embedded désactivée de la détectabilité du contenu sur Microsoft 365. La réponse inclut toutes les instances de conteneur (drive) du type de conteneur spécifié dans le locataire :

Demande

POST /search/query
Content-Type: application/json

{
  "requests": [
    {
      "entityTypes": [
        "drive"
      ],
      "query": {
        "queryString": "ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
      },
      "sharePointOneDriveOptions": {
        "includeHiddenContent": true
      }
    }
  ]
}

Réponse

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
  "value": [
    {
      "searchTerms": [],
      "hitsContainers": [
        {
          "hits": [
            {
              "hitId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
              "rank": 1,
              "summary": "Everything about Contoso",
              "resource": {
                "@odata.type": "#microsoft.graph.drive",
                "id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
                "createdBy": {
                  "user": {
                    "displayName": "Dylan Williams"
                  }
                },
                "lastModifiedDateTime": "2024-01-18T19:45:25Z",
                "name": "AllItems.aspx",
                "parentReference": {
                  "sharepointIds": {
                    "listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4"
                  },
                  "siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
                },
                "webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/Forms/AllItems.aspx"
              }
            }
          ],
          "total": 1,
          "moreResultsAvailable": false
        }
      ]
    }
  ]
}

Exemple 2 : Rechercher des conteneurs par titre

Cet exemple interroge tous les conteneurs avec un nom d’affichage de conteneur spécifié et l’application SharePoint Embedded n’a pas choisi de refuser la découverte de contenu sur Microsoft 365. La réponse inclut toutes les instances de conteneur dans le locataire qui correspondent aux critères :

Demande

POST /search/query
Content-Type: application/json

{
  "requests": [
    {
      "entityTypes": [
        "drive"
      ],
      "query": {
        "queryString": "Title:'contoso' AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
      }
    }
  ]
}

Réponse

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
  "value": [
    {
      "searchTerms": [
        "contoso"
      ],
      "hitsContainers": [
        {
          "hits": [
            {
              "hitId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
              "rank": 1,
              "summary": "Everything about Contoso",
              "resource": {
                "@odata.type": "#microsoft.graph.drive",
                "id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
                "createdBy": {
                  "user": {
                    "displayName": "Dylan Williams"
                  }
                },
                "lastModifiedDateTime": "2024-01-18T19:45:25Z",
                "name": "AllItems.aspx",
                "parentReference": {
                  "sharepointIds": {
                    "listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4"
                  },
                  "siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
                },
                "webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/Forms/AllItems.aspx"
              }
            }
          ],
          "total": 1,
          "moreResultsAvailable": false
        }
      ]
    }
  ]
}

Exemple 3 : Rechercher des conteneurs par description de conteneur

Cet exemple interroge tous les conteneurs en fonction du type de conteneur et de la description de conteneur spécifiés, avec l’application SharePoint Embedded désactivée de la détectabilité du contenu sur Microsoft 365. La réponse inclut toutes les instances de conteneur dans le locataire qui correspondent aux critères :

Demande

POST /search/query
Content-Type: application/json

{
  "requests": [
    {
      "entityTypes": [
        "drive"
      ],
      "query": {
        "queryString": "Description:'Everything' AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
      },
      "sharePointOneDriveOptions": {
        "includeHiddenContent": true
      }
    }
  ]
}

Réponse

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
  "value": [
    {
      "searchTerms": [],
      "hitsContainers": [
        {
          "hits": [
            {
              "hitId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
              "rank": 1,
              "summary": "<c0>Everything</c0> about Contoso<ddd/>",
              "resource": {
                "@odata.type": "#microsoft.graph.drive",
                "id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
                "createdBy": {
                  "user": {
                    "displayName": "Dylan Williams"
                  }
                },
                "lastModifiedDateTime": "2024-01-18T19:45:25Z",
                "name": "AllItems.aspx",
                "parentReference": {
                  "sharepointIds": {
                    "listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4"
                  },
                  "siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
                },
                "webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/Forms/AllItems.aspx"
              }
            }
          ],
          "total": 1,
          "moreResultsAvailable": false
        }
      ]
    }
  ]
}

Exemple 4 : Rechercher du contenu par titre dans un conteneur spécifique

Cet exemple interroge tout le contenu par un titre spécifique dans un conteneur spécifique instance, avec l’application SharePoint Embedded désactivée de la découverte du contenu sur Microsoft 365. La réponse inclut tout driveItems dans le conteneur spécifique instance qui correspondent aux critères :

Demande

POST /search/query
Content-Type: application/json

{
  "requests": [
    {
      "entityTypes": [
        "driveItem"
      ],
      "query": {
        "queryString": "Title:'contoso' AND ContainerId:b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0"
      },
      "sharePointOneDriveOptions": {
        "includeHiddenContent": true
      }
    }
  ]
}

Réponse

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
  "value": [
    {
      "searchTerms": [
        "contoso",
        "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0"
      ],
      "hitsContainers": [
        {
          "hits": [
            {
              "hitId": "01SHAK4OWIBDXV4NG2JVFLSGUXVKZ5VF5E",
              "rank": 1,
              "summary": "Contoso Detailed Design Contoso Product Specification",
              "resource": {
                "@odata.type": "#microsoft.graph.driveItem",
                "size": 56,
                "fileSystemInfo": {
                  "createdDateTime": "2024-01-18T19:46:48Z",
                  "lastModifiedDateTime": "2024-01-18T19:46:48Z"
                },
                "listItem": {
                  "@odata.type": "#microsoft.graph.listItem",
                  "fields": {},
                  "id": "5eef08c8-da34-4a4d-b91a-97aab3da97a4"
                },
                "id": "01SHAK4OWIBDXV4NG2JVFLSGUXVKZ5VF5E",
                "createdBy": {
                  "user": {
                    "displayName": "Dylan Williams",
                    "email": "dywilliams@contoso.onmicrosoft.com"
                  }
                },
                "createdDateTime": "2024-01-18T19:46:48Z",
                "lastModifiedBy": {
                  "user": {
                    "displayName": "Dylan Williams",
                    "email": "dywilliams@contoso.onmicrosoft.com"
                  }
                },
                "lastModifiedDateTime": "2024-01-18T19:46:48Z",
                "name": "contoso.txt",
                "parentReference": {
                  "driveId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
                  "id": "01SHAK4OVPJ5Q5P6YD6VCZHPV7PKILUJ65",
                  "sharepointIds": {
                    "listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4",
                    "listItemId": "1",
                    "listItemUniqueId": "5eef08c8-da34-4a4d-b91a-97aab3da97a4"
                  },
                  "siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
                },
                "webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/contoso.txt"
              }
            }
          ],
          "total": 1,
          "moreResultsAvailable": false
        }
      ]
    }
  ]
}

Exemple 5 : Rechercher par contenu

Cet exemple interroge tout le contenu à l’aide des mots spécifiés sur tous les conteneurs d’un type de conteneur spécifique, l’application SharePoint Embedded ayant refusé la découverte du contenu sur Microsoft 365. La réponse inclut tout driveItems ce qui correspond aux critères :

Demande

POST /search/query
Content-Type: application/json

{
  "requests": [
    {
      "entityTypes": [
        "driveItem"
      ],
      "query": {
        "queryString": "'contoso' AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
      },
      "sharePointOneDriveOptions": {
        "includeHiddenContent": true
      }
    }
  ]
}

Réponse

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)"
  "value": [
    {
      "searchTerms": [
        "contoso"
      ],
      "hitsContainers": [
        {
          "hits": [
            {
              "hitId": "01SHAK4OWIBDXV4NG2JVFLSGUXVKZ5VF5E",
              "rank": 1,
              "summary": "<c0>Contoso</c0> Detailed Design <c0>Contoso</c0> Product Specification<ddd/>",
              "resource": {
                "@odata.type": "#microsoft.graph.driveItem",
                "size": 56,
                "fileSystemInfo": {
                  "createdDateTime": "2024-01-18T19:46:48Z",
                  "lastModifiedDateTime": "2024-01-18T19:46:48Z"
                },
                "listItem": {
                  "@odata.type": "#microsoft.graph.listItem",
                  "fields": {},
                  "id": "5eef08c8-da34-4a4d-b91a-97aab3da97a4"
                },
                "id": "01SHAK4OWIBDXV4NG2JVFLSGUXVKZ5VF5E",
                "createdBy": {
                  "user": {
                    "displayName": "Dylan Williams",
                    "email": "dywilliams@contoso.onmicrosoft.com"
                  }
                },
                "createdDateTime": "2024-01-18T19:46:48Z",
                "lastModifiedBy": {
                  "user": {
                    "displayName": "Dylan Williams",
                    "email": "dywilliams@contoso.onmicrosoft.com"
                  }
                },
                "lastModifiedDateTime": "2024-01-18T19:46:48Z",
                "name": "contoso.txt",
                "parentReference": {
                  "driveId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
                  "id": "01SHAK4OVPJ5Q5P6YD6VCZHPV7PKILUJ65",
                  "sharepointIds": {
                    "listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4",
                    "listItemId": "1",
                    "listItemUniqueId": "5eef08c8-da34-4a4d-b91a-97aab3da97a4"
                  },
                  "siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
                },
                "webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/contoso.txt"
              }
            }
          ],
          "total": 1,
          "moreResultsAvailable": false
        }
      ]
    }
  ]
}

Exemple 6 : Rechercher des conteneurs par propriété personnalisée de conteneur

Cet exemple interroge tous les conteneurs à l’aide de la paire clé/valeur de propriété personnalisée spécifiée, avec l’application SharePoint Embedded qui a refusé la découverte du contenu sur Microsoft 365. La réponse inclut tous les conteneurs qui correspondent aux critères :

Remarque

Le nom de la propriété personnalisée doit être ajouté avec le texte « OWSTEXT » dans la chaîne de requête.

Demande

POST /search/query
Content-Type: application/json

{
  "requests": [
    {
      "entityTypes": [
        "drive"
      ],
      "query": {
        "queryString": "customPropertyNametOWSTEXT:customPropertyValue AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
      },
      "sharePointOneDriveOptions": {
        "includeHiddenContent": true
      }
    }
  ]
}

Réponse

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
  "value": [
    {
      "searchTerms": [],
      "hitsContainers": [
        {
          "hits": [
            {
              "hitId": "b!C4Psl-ZZZkaZINVay8RKt2fqu3agJbVNlIUjNuIzqlPhOJMrr7ThS4aR8L8XdZu4",
              "rank": 1,
              "summary": "Everything about Contoso",
              "resource": {
                "@odata.type": "#microsoft.graph.drive",
                "id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
                "createdBy": {
                  "user": {
                    "displayName": "Dylan Williams"
                  }
                },
                "lastModifiedDateTime": "2024-08-02T17:31:06Z",
                "name": "AllItems.aspx",
                "parentReference": {
                  "sharepointIds": {
                    "listId": "2b9338e1-b4af-4be1-8691-f0bf17759bb8"
                  },
                  "siteId": "contoso.sharepoint.com,97ec830b-59e6-4666-9920-d55acbc44ab7,76bbea67-25a0-4db5-9485-2336e233aa53"
                },
                "webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_97ec830b-59e6-4666-9920-d55acbc44ab7/Document Library/Forms/AllItems.aspx"
              }
            }
          ],
          "total": 1,
          "moreResultsAvailable": false
        }
      ]
    }
  ]
}

Exemple 7 : Rechercher du contenu avec des propriétés de contenu spécifiques dans le corps de la réponse et trier les résultats

Cet exemple interroge le contenu du conteneur par des mots spécifiques et exige que la réponse inclue tous les attributs spécifiés sur le contenu. Les propriétés pouvant être triées peuvent être utilisées pour trier les résultats.

Demande

POST /search/query
Content-Type: application/json

{
  "requests": [
    {
      "entityTypes": [
        "driveItem"
      ],
      "query": {
        "queryString": "Everything about contoso"
      },
      "sharePointOneDriveOptions": {
        "includeHiddenContent": true
      },
      "fields": [
        "SampleOWSText",
        "id",
        "name",
        "parentReference",
        "file",
        "folder",
        "webUrl",
        "createdDateTime",
        "lastModifiedDateTime",
        "size",
        "fileSystemInfo",
        "createdBy",
        "lastModifiedBy",
        "fileSystemInfo",
        "fileSystemInfo"
      ],
        "sortProperties": [
            {
              "name": "Created",
              "isDescending": false
            }
          ]
    }
  ]
}

Réponse

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
  "value": [
    {
      "searchTerms": [
        "everything",
        "about",
        "contoso"
      ],
      "hitsContainers": [
        {
          "hits": [
            {
              "hitId": "017JL52SWZQ2M5MULUKFBIL7SZ56EB4V2Z",
              "rank": 1,
              "summary": "Everything about Contoso",
              "resource": {
                "@odata.type": "#microsoft.graph.driveItem",
                "size": 17363,
                "fileSystemInfo": {
                  "createdDateTime": "2024-06-20T21:49:03Z",
                  "lastModifiedDateTime": "2024-04-01T16:57:00Z"
                },
                "listItem": {
                  "@odata.type": "#microsoft.graph.listItem",
                  "id": "d69986d9-7451-4251-85fe-59ef881e5759",
                  "fields": {
                    "sampleOWSText": "Sample Value",
                    "id": "AAAAAH_MwHAjYctMtjgTN1cWJnYHAApvY20ubJFGtzLui9sETKcAAAAAASsAAApvY20ubJFGtzLui9sETKcAAAAAJqsAAA2",
                    "size": 17363,
                    "createdBy": "Dylan Williams"
                  }
                },
                "id": "017JL52SWZQ2M5MULUKFBIL7SZ56EB4V2Z",
                "createdBy": {
                  "user": {
                    "displayName": "Dylan Williams",
                    "email": "dywilliams@contoso.onmicrosoft.com"
                  }
                },
                "createdDateTime": "2024-06-20T21:49:03Z",
                "lastModifiedBy": {
                  "user": {
                    "displayName": "Dylan Williams",
                    "email": "dywilliams@contoso.onmicrosoft.com"
                  }
                },
                "lastModifiedDateTime": "2024-04-01T16:57:00Z",
                "name": "Constoso Details.docx",
                "parentReference": {
                  "driveId": "b!rWzsZXXFWEOeeP31bSE5BTjn_6qC3dFNloUBMv62EMilewHuRwQrQau-zcJu2BT0",
                  "id": "017JL52SXQSKBKPB7VKZCJE5ZSWUN4LZDZ",
                  "sharepointIds": {
                    "listId": "ee017ba5-0447-412b-abbe-cdc26ed814f4",
                    "listItemId": "1",
                    "listItemUniqueId": "d69986d9-7451-4251-85fe-59ef881e5759"
                  },
                  "siteId": "contoso.sharepoint.com,65ec6cad-c575-4358-9e78-fdf56d213905,aaffe738-dd82-4dd1-9685-0132feb610c8"
                },
                "webUrl": "https://contoso.sharepointt.com/contentstorage/CSP_65ec6cad-c575-4358-9e78-fdf56d213905/Document Library/Constoso Details.docx"
              }
            }
          ],
          "total": 1,
          "moreResultsAvailable": false
        }
      ]
    }  
  ]
}

Limitations connues

  • Les demandes de recherche s’exécutent dans le contexte de l’utilisateur connecté. Les résultats de la recherche sont limités uniquement pour appliquer tout contrôle d’accès appliqué aux éléments par l’utilisateur. Par exemple, les résultats de la recherche incluent tout le contenu du conteneur ou du conteneur correspondant aux critères de recherche et accessible par l’utilisateur, que l’application SharePoint Embedded soit ou non autorisée à y accéder. Vous devez spécifier le type de conteneur souhaité en incluant containerTypeId dans le cadre de votre queryString lors de la recherche de conteneurs ou de contenu de conteneur pour vous assurer que les résultats de la recherche sont correctement délimités.
  • Pour que votre application accède aux conteneurs ou au contenu du conteneur dans les résultats de recherche, elle doit disposer d’autorisations d’accès aux types de conteneurs correspondants.

Énumérer (filtrer) le contenu SharePoint Embedded

Le contenu peut également être énuméré à l’aide de paramètres d’URL pour retourner du contenu spécifique dans les conteneurs SharePoint Embedded. Cela n’utilise pas l’API de recherche pour récupérer des éléments. Consultez le paramètre de requête d’énumération pour référence.

Exemple 1 : énumérer le contenu par une propriété de colonne spécifique et afficher les résultats

Cet exemple énumère le contenu du conteneur spécifié par la propriété column qui se trouve sur l’élément :

Demande

GET https://graph.microsoft.com/v1.0/drives/{{ContainerID}}/items?$filter=startswith(listitem/fields/{{ColumnProperty}}, '{{Value}}')&$expand=listitem($expand=fields)

Réponse

HTTP/1.1 200 OK
Content-type: application/json
{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('b%21CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF')/items(listItem(fields()))",
  "value": [
    {
      "@odata.etag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
      "@microsoft.graph.downloadUrl": "https://<tenant>.sharepoint.com/contentstorage/CSP_f96ae408-28af-41ad-88ad-ddffcfdb75fe/_layouts/15/download.aspx?UniqueId=b8051d89-836e-4b8e-bd2b-7634bac92825&Translate=false&tempauth=v1.eyJzaXRlaWQiOiJmOTZhZTQwOC0yOGFmLTQxYWQtODhhZC1kZGZmY2ZkYjc1ZmUiLCJhcHBfZGlzcGxheW5hbWUiOiJTUEUtQmFzZWJhbGwiLCJhcHBpZCI6ImZiN2NmNTIwLWNiMzMtNDViZi1hMjM4LWFlNTFkMzE2NjY1ZiIsImF1ZCI6IjAwMDAwMDAzLTAwMDAtMGZmMS1jZTAwLTAwMDAwMDAwMDAwMC9wdWNlbGlrZW50ZXJwcmlzZS5zaGFyZXBvaW50LmNvbUAxNTNhNmViZS1mZjYyLTRiY2UtYjFiYy1hMWVkYTNiYzY2NDUiLCJleHAiOiIxNzMxNjE3MDE3In0.CgoKBHNuaWQSAjY5EgsIzpKzp9W7wj0QBRoNMjAuMTkwLjEzNS40MioscW54cjFGalBneHh2N1lGTkp1dUpxTFZWdFFIS1hOQ2RlQ3EvUUk2aHhlcz0wuAE4AUIQoWPmC1YwAABF4iHcgCWrfkoQaGFzaGVkcHJvb2Z0b2tlbnIpMGguZnxtZW1iZXJzaGlwfDEwMDM3ZmZlOWE5NDg5ZGRAbGl2ZS5jb216ATKCARIJvm46FWL_zksRsbyh7aO8ZkWSAQVTdGV2ZZoBB1B1Y2VsaWuiASdzdGV2ZUBwdWNlbGlrZW50ZXJwcmlzZS5vbm1pY3Jvc29mdC5jb22qARAxMDAzN0ZGRTlBOTQ4OUREsgFyY29udGFpbmVyLnNlbGVjdGVkIGFsbGZpbGVzLnJlYWQgYWxsZmlsZXMud3JpdGUgY29udGFpbmVyLnNlbGVjdGVkIGFsbHNpdGVzLnJlYWQgYWxscHJvZmlsZXMucmVhZCBhbGxwcm9maWxlcy5yZWFkyAEB.tfaYgtjhQxMctJeHUWb9RU7CChHXqFHT0FaM9Dt7J9I&ApiVersion=2.1",
      "createdDateTime": "2024-09-20T16:46:00Z",
      "eTag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
      "id": "01UELPCREJDUC3Q3UDRZF32K3WGS5MSKBF",
      "lastModifiedDateTime": "2024-11-01T08:14:28Z",
      "name": "ClaimExample-1.docx",
      "size": 2299607,
      "webUrl": "https://<tenant>.sharepoint.com/contentstorage/CSP_f96ae408-28af-41ad-88ad-ddffcfdb75fe/_layouts/15/Doc.aspx?sourcedoc=%7BB8051D89-836E-4B8E-BD2B-7634BAC92825%7D&file=ClaimExample-1.docx&action=default&mobileredirect=true",
      "cTag": "\"c:{B8051D89-836E-4B8E-BD2B-7634BAC92825},5\"",
      "commentSettings": {
        "commentingDisabled": {
          "isDisabled": false
        }
      },
      "createdBy": {
        "application": {
          "displayName": "SPEContainerType",
          "id": "fb7cf520-cb33-45bf-a238-ae51d316665f"
        },
        "user": {
          "displayName": "SharePoint App"
        }
      },
      "lastModifiedBy": {
        "application": {
          "displayName": "SPEContainerType",
          "id": "fb7cf520-cb33-45bf-a238-ae51d316665f"
        },
        "user": {
          "displayName": "Steve Pucelik",
          "email": "Steve@<tenant>.onmicrosoft.com"
        }
      },
      "parentReference": {
        "driveId": "b!CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF",
        "driveType": "other",
        "id": "01UELPCRF6Y2GOVW7725BZO354PWSELRRZ",
        "path": "/drives/b!CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF/root:",
        "sharepointIds": {
          "listId": "e6e197c4-4ab3-43a8-b402-5983507c6385",
          "listItemUniqueId": "c4782251-bdd3-4766-a747-b2a2f51c3a00",
          "siteId": "f96ae408-28af-41ad-88ad-ddffcfdb75fe",
          "siteUrl": "https://<teannt>.sharepoint.com/contentstorage/CSP_f96ae408-28af-41ad-88ad-ddffcfdb75fe",
          "tenantId": "153a6ebe-ff62-4bce-b1bc-a1eda3bc6645",
          "webId": "2705c2f8-33aa-4a72-8438-25114dc3203b"
        }
      },
      "file": {
        "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
        "hashes": {
          "quickXorHash": "DMzi0kCsuukcHlMXiPX9tmTCXtA="
        }
      },
      "fileSystemInfo": {
        "createdDateTime": "2024-09-20T16:46:00Z",
        "lastModifiedDateTime": "2024-11-01T08:14:28Z"
      },
      "shared": {
        "scope": "unknown"
      },
      "listItem@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('b%21CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF')/items('01UELPCREJDUC3Q3UDRZF32K3WGS5MSKBF')/listItem(fields())/$entity",
      "listItem": {
        "@odata.etag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
        "createdDateTime": "2024-09-20T16:46:00Z",
        "eTag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
        "id": "23",
        "lastModifiedDateTime": "2024-11-01T08:14:28Z",
        "webUrl": "https://<tenant>.sharepoint.com/contentstorage/CSP_f96ae408-28af-41ad-88ad-ddffcfdb75fe/_layouts/15/Doc.aspx?sourcedoc=%7BB8051D89-836E-4B8E-BD2B-7634BAC92825%7D&file=ClaimExample-1.docx&action=default&mobileredirect=true",
        "createdBy": {
          "application": {
            "displayName": "SPEContainerType",
            "id": "fb7cf520-cb33-45bf-a238-ae51d316665f"
          },
          "user": {
            "displayName": "SharePoint App"
          }
        },
        "lastModifiedBy": {
          "application": {
            "displayName": "SPEContainerType",
            "id": "fb7cf520-cb33-45bf-a238-ae51d316665f"
          },
          "user": {
            "displayName": "Steve Pucelik",
            "email": "Steve@M<tenant>.onmicrosoft.com"
          }
        },
        "parentReference": {
          "id": "0",
          "path": "Document Library",
          "siteId": "f96ae408-28af-41ad-88ad-ddffcfdb75fe"
        },
        "contentType": {
          "id": "0x0101004368E78BC3115C4CAD94FEA35E0F9D90",
          "name": "Document"
        },
        "fields@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('b%21CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF')/items('01UELPCREJDUC3Q3UDRZF32K3WGS5MSKBF')/listItem/fields/$entity",
        "fields": {
          "@odata.etag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
          "id": "23",
          "FileLeafRef": "ClaimExample-1.docx",
          "<ColumnProperty>": "<Value>",
          "ContentType": "Document",
          "Created": "2024-09-20T16:46:00Z",
          "AuthorLookupId": "1073741822",
          "Modified": "2024-11-01T08:14:28Z",
          "EditorLookupId": "7",
          "_CheckinComment": "",
          "LinkFilenameNoMenu": "ClaimExample-1.docx",
          "LinkFilename": "ClaimExample-1.docx",
          "DocIcon": "docx",
          "FileSizeDisplay": "2299607",
          "ItemChildCount": "0",
          "FolderChildCount": "0",
          "_ComplianceFlags": "",
          "_ComplianceTag": "",
          "_ComplianceTagWrittenTime": "",
          "_ComplianceTagUserId": "",
          "_CommentCount": "",
          "_LikeCount": "",
          "_DisplayName": "Confidential \\ Internal only",
          "AppAuthorLookupId": "1",
          "AppEditorLookupId": "1",
          "Edit": "0",
          "_UIVersionString": "19.0",
          "MediaServiceImageTags@odata.type": "#Collection(microsoft.graph.Json)",
          "MediaServiceImageTags": []
        }
      }
    }
  ]
}

Exemple 2 : Énumérer le contenu par une propriété de colonne spécifique et trier les résultats

Cet exemple énumère le contenu du conteneur spécifié par la propriété column qui se trouve sur l’élément et trie les résultats en fonction de la colonne spécifiée :

Demande

GET https://graph.microsoft.com/v1.0/drives/{{ContainerID}}/items?$filter=listitem/fields/{{ColumnProperty}} eq '{{Value}}'&$select=id,name,lastModifiedDateTime,size&$expand=listitem($expand=fields)&$orderby=createdDateTime desc
Headers:
Content-Type: application/json
Prefer: HonorNonIndexedQueriesWarningMayFailRandomly

Remarque

Lorsqu’un conteneur contient plus de 5 000 éléments et que vous utilisez la méthode enumerate avec la clause OrderBy, vous devez inclure les éléments suivants dans l’en-tête de votre demande.

Content-Type: application/json Prefer: HonorNonIndexedQueriesWarningMayFailRandomly

Exemple 3 : Énumérer le contenu par mulitple des propriétés de colonne et Trier les résultats

Cet exemple énumère le contenu du conteneur spécifié par la propriété column que vous spécifiez et le nom du document (listitem/fields/FileLeafRef) qui se trouve sur l’élément et trie les résultats selon la colonne spécifiée :

Demande

GET https://graph.microsoft.com/v1.0/drives/{{ContainerID}}/items?$filter=listitem/fields/{{ColumnProperty1}} eq '{{Value}}' AND listitem/fields/FileLeafRef eq '{{Value}}' &$select=id,name,lastModifiedDateTime,size&$expand=listitem($expand=fields)&$orderby=createdDateTime desc
Headers:
Content-Type: application/json
Prefer: HonorNonIndexedQueriesWarningMayFailRandomly