Graph API & Upload file to Sharepoint Document library - sharepoint

I try to upload files to sharepoint document library using the Graph API.
The request is : https://graph.microsoft.com/v1.0/drives/{{driveid}}/root:/myfolder/mydoc.pdf:/content
The request goes with bearer token and the binary file in the body.
The response is "201 Created" and all seems to be good.
But in the document library I can see the folder but there is no file at all.
(If I look at files in the sharepoint with GET request I can see the file !).
Can you help me to find why files are not visible in the sharepoint web view ?

I finally found the solution to my problem.
For the file to be visible by all users, you have to checkin the uploaded file with a POST request from the Graph API.

Related

Facebook Graph API v10 image upload to Pages feed

I'm trying to upload a image to facebook via graph api v10.
i have followed the docs: https://developers.facebook.com/docs/graph-api/resumable-upload-api/
I'm getting the File-Handle as result, but i dont know how to append this File-handle to my Page post. Does anyone know what i can do with this File-Handle to attach it to a Post I'm automatically posting after the file upload was successful?
Thanks!
I´ve got the same problem. In the Facebook Graph API Documentation it says:
When we're done with uploading the data, you'll get a file handle:
{"h":"2:c2FtcGxlLm1wNA==:image/jpeg:GKAj0gAUCZmJ1voFADip2iIAAAAAbugbAAAA:e:1472075513:ARZ_3ybzrQqEaluMUdI"}
This value can be used in place of an uploaded file for subsequent
graph calls.
However, no examples or further explanations are provided on how to use the received file handler.

“The validation of the PDF file failed.” When trying to send a generated PDF via email - DocuSign

We have some code which downloads a PDF file from Google Drive using the Drive API, after that we use the file to build a new envelope and send it to the customer.
Using the same file, some of these requests work, and some come back with an error "PDF_VALIDATION_FAILED".
I have the log(file) file which contains the base64 of the file and the request information, using an external tool to convert the base64 to PDF it seems to be valid and also I tried to open the file using Adobe acrobat and the document appears fine.
Is there any documentation on what makes a pdf invalid?
Thanks in Advance
If you can upload the file to a DocuSign envelope using the DocuSign web app, but it doesn't work when you use the API:
If the file type is not pdf then include the file extension in the name attribute. Eg contract.docx. The fileExtension attribute is somethimes not used by the platform.
You have a problem with your Base64 encoding method. Modify one of the DocuSign code examples to send your file and it will work.

Sending client file download link

I have a nodejs backend and I want to send a file download link to the client such that, the file is directly accessible by the client. The file types are JPEG and PNG. Currently, I am serving these files as data-uri but, due to a change in requirements, I must send a download link in response to the file request and, client can download the file later using that link.
Now the current workflow exposes a path /getAvatar. This path should send a response back to the client with the file link. The file, is stored in /assets/avatars relative to the server root. I know I can express.static middleware to send back static resources. However, the methods I have seen so far, res.send() and res.download() both tries to send the file as attachment rather a link that can be used later to download.
Basically, the behavior is like a regular file sharing site where, once a file is clicked, a link to it is generated which, is used for downloading the file. How can I do this?

Is HTTP PUT access required for uploading to SharePoint via the SaveBinaryDirect method?

We have developed a .NET console application to do file uploading to a SharePoint 2016 document library. The application was built using the Microsoft.SharePoint2016.CSOM library, with file uploading using on the Microsoft.SharePoint.Client.File.SaveBinaryDirect() method call.
Based on results from a web vulnerability scanning, there was a request that the “HTTP PUT method” should be disabled in IIS. However after some testing, we found that
If “HTTP PUT” is enabled, the file upload is successful
If “HTTP PUT” is disabled, the console application would return a 404 error from the file uploading step
We would like to confirm whether “HTTP PUT method” is necessary (and cannot be disabled) for the SharePoint CSOM SaveBinaryDirect() method.
If you use Fiddler to monitor the request, you can find it's PUT request.
First of all, to access the SharePoint services(rest/web) the user should be authenticated. Its not like anyone can upload a file. People can use POST instead of PUT for uploading etc. So I am not sure what type of quality check you are using.
These are the out of the box services SharePoint is providing and I have seen very big enterprises using it without the changes you have suggested.

Creating Excel file in OneDrive

I'm trying to integrate with Microsoft OneDrive service. I read API docs and went throw Authorization. Unfortunatelly, there's no info in docs about creating different File types.
I created a .txt file using HTTP Requests as it's written here https://dev.onedrive.com/items/upload_put.htm .
When I'm trying to create an Excel file this way, it does, but the document doesn't open. I think I need to send some special params (metadata?) also, but I don't know which ones.
I would be very pleased for any help :)

Resources