-
Notifications
You must be signed in to change notification settings - Fork 233
List Item Attachment progress callback #773
Comments
Hey Chan,
For files upload (into the doc libs), there is |
Thanks. Any plans to add this as an enhancement? |
I have some concerns that chunked upload is even available for |
I do not believe that is supported for list attachments. If you need attachments that are large I would recommend a document library with a lookup column back to the list item to link them. Document libraries are optimized for large files more so than attachments. |
add() works for me but not addChunked() Following produces a HTTP 500 error:
This works fine:
When I catch the error from the promise and print out stack property:
|
What is the version of SharePoint? |
Using SPO. More specifically, I use Express as my local server and sp-rest-proxy to forward requests to SPO. |
What version of the Proxy? I guess I added |
Any reason why We have NG1 code that interacts with a document' library's rootFolder/files endpoint on SP2013 production server. We use a third party NG1 service to make the request for us.
Promise returned from Upload.http() allows us to specify three callback functions, the last of which allows us to monitor upload progress. This library is found at https://github.com/danialfarid/ng-file-upload |
sp-rest-proxy@2.5.3 |
Add chunked support was added in 2.5.4. When somebody in the team tried it within React component targeted to SPO, then tests showed up that the same code does not work with 2013. I made an assumption that the REST API back in time didn't support it. Never dig deeper. =) |
Do you know if https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js |
As far as I know, Angular's $http client deals with streams, it's not a fetch/promise based. Can take a look at the implementation, I guess that some features from Angular $http client are used. Could you please refer proxy's issue in proxy's repo? So we won't mix these two threads and projects.
Yes, |
It looks like the NG1 third-party service doesn't actually make multiple HTTP requests with chunks. It simply makes a single HTTP request for the upload, but listens to events on the XmlHttpRequest:
Is there any way I can access these low-level details XMLHttpRequest and attach listeners? I saw that you have a Iibrary configuration section but couldn't find anything there. |
I'm afraid there is no such possibility in Fetch client. Yes, Fetch is a modern replacement for XMLHttpRequest, but it is a downside of simplicity - missing some features. UPD: |
Thanks for the link. I will use your suggestion for this specific use-case. Is there a low-level utility using sp-pnp-js that allows me to easily get the X-RequestDigest? I know the fluent API handles those details for us. |
Can't check at the moment, but maybe something like this (blind coding alert): import { HttpClient } from 'sp-pnp-js';
import { DigestCache } from 'sp-pnp-js/lib/net/digestcache';
const webUrl = 'https://contoso.sharepoint.com';
const digestCache = new DigestCache(new HttpClient());
digestCache.getDigest(webUrl).then(digest => {
console.log(digest);
}); |
You can do that or you could just steal the code from the DigestCache class and use it in your application if you want to avoid using the library. Might be easier. Another alternative would be to show a visual element like a spinner and remove it once the file is uploaded. Attachments should be fairly small so the upload time would be pretty quick. |
Going to close this as answered, please reopen should you need to continue the conversation. Thanks! |
Category
[ ] Enhancement
[ ] Bug
[x] Question
Version
3.0.1
Expected / Desired Behavior / Question
I can see add method returns a AttachmentFileAddResult. Is it possible to subscribe to some sort of progress call back, so I can update a progress bar on my UI? If so, how would I accomplish this?
Thanks!
The text was updated successfully, but these errors were encountered: