purtuga / SPWidgets

Sharepoint Custom UI Widgets
74 stars 34 forks source link

Excellent tool - trying few modifications #79

Closed shankarnss closed 6 years ago

shankarnss commented 6 years ago

Dear Paul,

I was looking at SP Widgets and the tool is awesome. I was able to do a test implementation and it was easy and successful.

I was trying to achieve few modifications: 1) Replicate the upload button click in a custom button. Is it possible? if yes could you please give me some pointers.

2) Encountered an issue: Sometimes the upload/busy wheel keeps spinning and I do not see any messages. I think some function/script is running infinitely. How do i pin point it?

3) Exception handling: I found the events '1' No File uploaded, Upload form is ready for user input. '2' No File uploaded. User has defined.. & '3' File has been uploaded. what is the difference between 1 & 2? How do i handle other exceptions? is there anything defined?

Really appreciate your help on this.

With regards, Shankar

purtuga commented 6 years ago

Thanks for opening a new thread @shankarnss

Regarding your questions:

re: 1 - replicate upload button

No, that is not possible. The entire "upload" area is actually an iframe in disguise and very fragile to changes.

re: 2 - upload busy wheel keeps spinning

Its hard to say what the issue might be... When does this happen? when initially displaying the widget? or after the user has selected a file adn clicks Upload?

re: 3 - Event handling

The event object is documented here - https://github.com/purtuga/SPWidgets/blob/master/documentation/SPWidgets.SPControlUpload.md#event-object

1 is set when the widget is ready for user input (behind the scenes, the iframe has loaded the sharepoint upload.aspx page)

2 means that the user selected a file, but has not yet clicked the "upload" button.

Take a look at the documentation link above and also at the examples at the bottom of that page for more information on how the Event object can be used.

I should also note that this widget is quite old and not currently under active development. If you are using SP 2013 or above, there are better APIs available in Sharepoint that allow you to build better upload widgets - specially if your users are using a modern browser.

/Paul

shankarnss commented 6 years ago

Hello Paul,

Thank you very much for the quick response. My client is running SP 2013 in SP 2010 compatibility mode. Do you have any recommendations on other API's for file upload? Can you provide some pointers?

Thank you, Shankar

purtuga commented 6 years ago

Hi @shankarnss Since you are in SP2010 mode, I don't think you will have access to the newer REST APIs. you might want to look into the SOAP Copy service and the Copy.CopyIntoItems method - you may be able to achieve an upload using that and some JS on the browser that uses the FileReader APIs to get the file's data from the user's PC. A few google searches should send you down the right path. Hope this helps.