I am trying to create a file with sample content in a SharePoint Online Document Library using MS Graph.
MS Graph API:
https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/root:/filename.txt:/content
Can anyone please explain how to upload and what will be request body for this API ?
In postman, we could upload the file like this:
choose binary in the Body:
Related
I'm using the graph API to access the documents in SharePoint. The response I'm getting looks like this:
graph api response
I want to let the user open this file (an excel file in this example) using excel desktop app. In other words, I want to resemble in my app the "Open in desktop app" functionality Excel for the web already provides:
excel for the web functionality
Is that possible?
Thanks in advance!
You can try and get the webUrl of the parent folder of the document you want to open. On that webUrl you add:
String documentUrl = parentWebUrl + "/YourDocumentName.docx";
And then you use Office URI scheme to open it localy (read more here)
It should be possible to do it using the webUrl of the document itself, but i have not figured out how to do it.
I'm working with Graph API against Microsoft Teams team's SharePoint site.
I'm following the example on this page (https://learn.microsoft.com/en-us/graph/long-running-actions-overview?tabs=http) and have an issue. I'm able to query the location provided by the copy endpoint and get a "Completed" status that also provides a ResourceId. But I'm unable to use this resource id in any queries and only getting "Item not found".
Example of paths tried:
/drives/{driveId}/items/{resource-id-returned-from-monitor-url}
/groups/{groupId}/drive/items/{resource-id-returned-from-monitor-url}
The {driveID} is the driveId specified in the parentReference.DriveId in the copy file body.
I'm using the v1 Graph endpoint to get the file.
Btw, I can see the file fine in the correct folder within SharePoint.
Any ideas?
Regards,
Oskar
I wasn't using the DriveId supplied by the /education/***/setUpResourcesFolder Location header but rather the Drive of the class.
Fixed by using the driveId part of the Location URL.
I need api to create URL link for download document of envelope.
I found this api:
GET /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}
But this api just return the file and i what a URL i can download the file (of course with expired time)
The endpoint you're looking for is:
POST /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/views/recipient
You will need to provide in the body information about the recipient, see here for details:
https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient
We also have code examples in various langagues to show you how to do this here:
https://developers.docusign.com/esign-rest-api/code-examples/code-example-request-a-signature-via-email
I'm facing below error when I try to upload a file to sharepoint using access token.
x-msdavext_error →917656;
Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically.
I have given app permission request as follows:
AppPermissionRequests AllowAppOnlyPolicy="true">
And I have followed the steps mentioned in below post:
https://sharepoint.stackexchange.com/questions/250827/download-and-upload-file-from-share-point-using-java-rest-api-call.
Please help me out!!
Try to set the body to binary in Postman, check the similar thread as below.
Upload file to SharePoint online with HTTP REST calls
And refer to SharePoint REST API article here:
Working with folders and files with REST
what is the graph API to fetch the content of a folder in Microsoft Sharepoint?
What is the graph API to fetch the content of a file ?
Here the api to fetch the root elements works.
https://graph.microsoft.com/v1.0/sites/{site-id}/drive
what is the graph API to fetch the content of a folder in Microsoft
Sharepoint?
No specific API for this, you can try this workaround:
Use the following endpoint to get the file/sub-folder list in the root folder(if you know the folder name, you can jump to step 2 directly).
/drives/driveid/root:/{folder-name}:/children
Then check the item if have folder properties. We need to do this by ourselves(in-memory filter or such).
"folder": {
"childCount": 3
}
Get file/sub-folder list in the folder.
https://graph.microsoft.com/v1.0/me/drives/drive-id/root:/sub-folder-name:/
Do other logic on file based on your requirement by your self.
What is the graph API to fetch the content of a file ?
Get /sites/{site-id}/drive/items/{parent-id}:/{filename}:/content
More infomation:
https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/driveitem_get