Microsoft Graph API - Search content over a sharepoint site - search

We are creating a Sharepoint webpart that enable searching a Sharepoint site contents using Microsoft Graph Api. I am able to get the Lists and subsites
using graph Api, but not sure how to search any content at site level.
Looking for any pointers if this is even achievable.
Below are some of the API calls that work-
https://graph.microsoft.com/v1.0/sites/tenants/lists?select=id,name
https://graph.microsoft.com/v1.0/sites/tenants:/sites/sitename:/sites?search=subsitename
https://graph.microsoft.com/v1.0/sites/tenants:/sites/sitecollection:/lists

here is an example filtering on a list items
https://graph.microsoft.com/v1.0/sites/myThing.sharepoint.com,ffffffff-ffff-ffff-ffff-ffffffffffff,12345678-1234-1234-1234-123456789012/lists/25dd5a71-69a9-44f8-b60f-ed16718eae54/items?expand=fields(select%3DTitle,ID,ContentType,myLookupID)&top=1000&filter=fields/ContentType eq 'My Page'

Related

Fetch all sites from SharePoint by Microsoft Graph API

Does anyone know how I can fetch all sites from my SharePoint by using Microsoft Graph API?
I saw this documents but it seemed that there are no API to list sites.
And I saw this questions but answer was there were no ways.
List Microsoft Sharepoint Sites with Microsoft Graph
Could you help me?
Currently Graph API supported to get all SharePoint sites:
https://graph.microsoft.com/v1.0/sites?search=*
You can test in Graph Explorer firstly:
Reference:
Retrieve Site Collections And SubSites Using Microsoft Graph API

Need help on searching a document form Sitepage in Sharepoint using Microsoft Graph

I am working on SharePoint Integration where i am able to success using Microsoft Graph Explorer for a Site search using Drive id.
Here is how i am able search for a Single Site:
https://graph.microsoft.com/v1.0/drives/b!I9A-JY94D0CQp-2TBvsUupBLMUF2SrJHp5VylC7DY8DpCdF-7uQ6NTp6t-MRD8/root/search(q='sharepoint')
With this i am able to get the details of the record 'Sharepoint'.
Now i am trying to search in SitePage where we have Documents added. Can anyone please help me the api to be used in Graph Explorer to get the correct result
I am able to SitePage id using
https://graph.microsoft.com/beta/sites/root/pages?$filter=name eq 'DevHome.aspx'
Your Approach is incorrect.
If you have to search the content of the document library added to a Site page, you need to query the doc library not the Site page.
Using Graph API you will not be able to search the content in the site page.

How do I get started from reading SharePoint list information from outside of SharePoint?

We have a SharePoint subscription and an Azure subscription. I want to make a web app that is hosted in Azure, but the database for the app would basically be SharePoint lists. I'm looking up documentation on how to do this, but I'm just finding how to make "web parts" and they keep assuming I want to build my website inside SharePoint rather than outside.
How do I access a user's SharePoint lists from outside of SharePoint?
The easy part is the request for data. Use the SharePoint REST API. The harder part is authentication. How is the Azure app related to the SharePoint app? Same user login?
A sample REST call for select columns from a list:
https://yourDoamin/sites/yourSite/_api/web/lists/getbytitle('My List')/items?$select=Title,Price,Qty
The REST API also support filtering and sorting along with insert, update and delete.
A filter example:
https://yourDoamin/sites/yourSite/_api/web/lists/getbytitle('My List')/items?$select=Title,Price,Qty&$filter=Title eq 'Toys'
If you would like to experiment with the REST API from your SharePoint site, I have "REST tester" you can add to a Content Editor Web Part.
https://github.com/microsmith/SharePointRESTtester

How to create Content type in SharePoint using MSGraph api

Is it possible to create a SharePoint Content Type through MS Graph, like this POST https://graph.microsoft.com/v1.0/sites/{site-id}/ContentTypes? It seams that there are a lot of working endpoints that are not in the documentation.

Search for Content Across SharePoint Sites

Currently I'm using: /v1.0/sites/{site-id}/drive/root/search(q='{search-text}') but I would like to search across all the sites I have access to.
Is there a Microsoft Graph API which can search a keyword on all sites a user can access in SharePoint without giving site id?
There's no Graph API for a global content search at the moment.
However you can leverage the SharePoint Search API.

Resources