Why does Microsoft Graph preview item API return 404? - sharepoint

I'm using Microsoft Graph Search API to search items in my sites. Then I'm using the id and siteId found in response of above API to preview the item using POST /sites/{siteId}/drive/items/{itemId}/preview Microsoft Graph Preview driveItem API
Preview API works for some items, but it fails with 404 - itemNotFound for certain items. I have confirmed the item and site ids are same as that returned by Search API. I have also confirmed the item exists by searching and viewing it from SharePoint web.
Can someone help me with why the preview API returns 404 for certain items?

Related

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.

Add sharepoint custom field using Graph API

I want to upload my documents to my SharePoint site using Graph API. I followed the instruction in these posts and I'm able to upload my docs to Sharepoint site.
How to create SharePoint list item with Microsoft Graph API?
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_put_content
However, I want to update some values of uploaded documents in the Document Library items but I cannot find any document to do that. Please advise me in this situation.
Notice: I found the solution by this post.
How To Retrieve Custom Columns For DriveItems in MS Graph

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.

Microsoft Graph API - Search content over a sharepoint site

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'

Showing list of VSTS work items in Sharepoint document

In a Confluence page, you can show a list of Jira items via a JQL query.
I'm looking at migrating to VSTS work items and Sharepoint. In Sharepoint, is it possible to show a list of VSTS work items on a page? How to do this?
There is Work Items Rest API that could retrieve work item data from VSTS, so you can access external data with REST in SharePoint.

Resources