-
Notifications
You must be signed in to change notification settings - Fork 233
Update file contents with REST #214
Comments
Great suggestion, will try and sneak this into 1.0.5. |
Had a look at this and we do already have the saveBinaryStream method on file which takes a blob. Does that option not work for you or do you need some other functionality it isn't providing? |
Any updates here? Was the saveBinaryStream method what you needed? |
I did a quick test with pnp.sp.web.getFileByServerRelativeUrl(file.ServerRelativeUrl).saveBinaryStream(content) which produced a POST to api/web/getFileByServerRelativeUrl('/Document/test.txt')/saveBinary with a 404 as result. The documentation here is quite unclear about whether the endpoint is saveBinary or saveBinaryStream, https://msdn.microsoft.com/en-us/library/office/dn450841.aspx#bk_FileSaveBinaryStream. |
Thanks - will have a look and do some testing. |
Hi @Abrissirba , Check out the updates in this PR I just merged into dev: #232. Added better support for getting and setting file content to the File class. Also now easily supports chunked uploading for large files. Sample code for using the new methods.
|
Small note, can't actually merge currently due to permissions after transferring the repo ownership. |
Now merged in dev branch |
Looks good! |
Thanks, will close this as resolved - can reopen if the updates in dev aren't working for you. Thanks! |
Category
[x ] Enhancement
[ ] Bug
[x ] Question
Expected / Desired Behavior / Question
I want to be able to update the contents of a file with REST.
Observed Behavior
I can't see any way of making the rest call defined in https://msdn.microsoft.com/en-us/library/office/dn450841.aspx that suggest a call to getfilebyserverrelativeurl('/Shared Documents/filename.txt')/$value with the X-HTTP-METHOD set to PUT. I searched the code for $value but only found one occurrence and was only to get the content.
The text was updated successfully, but these errors were encountered: