I have tried what seems like about a dozen different methods of uploading files to sharepoint from a silverlight application. They either have severe limitations (file size limits of less than a meg or so) or lots of security issues that I have not been able to over come. I have tried:
WCF (We are trying not to use any custom WCF services at all FYI though this is the method that I have gotten to semi work)
Sharepoint Web services
Client object model
HTTP put
Webclient write stream
I have seen lots of different examples out there of people doing completely different things but none seem to work and all seem like they are the "old" way of doing things. I am using silverlight 4, sharepoint 2010 on IIS 7. Is there a best practice for uploading large (say 20-30 meg) files? I just want to dump a file into a document library.
I had similar issue. Tweaking web application level setting from central admin, changing asp.net limit in web.confit and following article helped me.
http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx
Just had a thought silverlight has a thing called an HTML Bridge which allows it to interact with the rest of the page. Consider calling a javascript function from Silverlight, and let the javascript function do the actual upload
UPDATE - the Javascript ClientOM doesn't seem to have the SaveBinaryDirect method :-(
How about doing some ExecuteQueryAsync and then in the success call back function (no longer on the UI thread), using the Microsoft.SharePoint.Client version of File? I know this would require downloading the larger assembly, so perhaps that's not so good.
I wonder if there is a way to get the clientOM use a more efficient binding when calling the web services...
Martin
The default upload size limit for the SharePoint client object model is 2 MB. You can change that limit by modifying the MaxReceivedMessageSize property of the service.
This can be done in two ways:
programatically - as described in this link - tho this won't work in Silverlight for example
trough the powershell. On the server where you have SharePoint installed, fire up the SharePoint Management Shell (make sure you run it under the farm administrator account) and run the following commands.
$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 52428800
$ws.Update()
This will change the upload limit to 52428800 bytes - or 50 MB. Now, restart the website hosting your SharePoint site (or the entire IIS) for the changes to take effect.
Related
So, i'm building my first SL application.
I tried to use the MVVM approach, and I think that's the way for me.
Basically, it's a simple application which shows data to the user, the data source is local (maybe in the future will be centric, but right now this is not the case), and the data should be retrieved by:
A. Calling file system's reading
and
B. Method calls from External DLLs
So, as I said, I started to work with MVVM (used this tutorial). I have 3 components: the service, the SL application and the project that host the SL app (excuse me if i'm not using the exact proffecional terms...).
My question is: Do you think that I've chose the right design? if so, is there any way not using IIS to host the service or is it a must? (I don't want to spend time on adminastrative tasks on clients' computers), because as I said, the data is local at the moment and IIS feels unnecessary.
I'll appriciate every comment on this. Thanks!
EDIT:
I'll try to simplify my question: I need my SL app to communicate with some kind of service - that will be able to take requests and reply back to the app.
This service suppose to be able to use .net dlls, and this service should be locally on each client run the app.
EDIT:
I noticed the Self host option.
Does anyone has any experience with it?
If your question is about: You having access to a database server somewhere, you should try WCF RIA Services. This will allow you to create service for each entity and the service will get included into your host project or you can even create a WCF RIA library.
As suppose to your MVVM pattern. I prefer splitting my Views from my ViewModels In different projects. I like to see them as a seperate layer.
Actually using ria services may mean that you have a number of services which apply to one user, but yes they are specific to the user. Which file system would you be attempting to access? The client or the server?
I finally decided to go with XBAP(WPF XAML Browser Application).
It suited perfectly to my requirements:
1. no deployment issues - just press a link, and .net enviroment will do the rest (downloading the needed assemblies, install them and finally run the app)
2. it's hosted on a browser
3. no IIS is needed!! it's a client-only application
I am working on an in-house, iOS app that will need read-only access to a SQL Server with multiple databases. I know the stock answer here is "write some web services", but I'd like a solution that is self-contained. Is there any way to directly connect to a SQL Server database from an iOS application? I'm thinking something like a basic ODBC connection.
I've seen a lot of users asking this question, but very few answers other than "write a web service." Is that really the only way?
A web service is indeed the only way, but Red Gate's written one you can reuse:
http://www.mobilefoo.com/iSqlServerSDK.html
http://labs.red-gate.com/Tools/Details/iSqlSDK
It's not officially released yet, just in beta, so keep in mind that features & prices may change.
Actually the easiest way is to create a MVC 3 or 4 asp.net web application. call the web methods. You don't need any API to pay for.
I use SBJson to serialize domain object and then send the objects as serialized jSOn to MVC 3. It's super easy to do. I even send images with base64, so it's .net compatible.
See my blog post with sample code:
http://nickturner.wordpress.com/2012/10/09/107/
So, after much searching and trial and error, unfortunately the best (only?) way I've found is indeed using Web Services.
Fortunately, Linq to SQL makes the WCF-creation-side incredibly easy. Once I got someone at work to walk me through setting up a Windows web server and adding the web service (and buying access to an online web server), the Windows side was up and ready to go.
I'm still working through all of the syntax stuff on the SOAP interaction side, but keeping my different methods somewhat similar in structure allows me to tinker a little until it works. By this time, I think I've gotten it to work pretty well.
So, both answers I got back were (disappointingly) correct. The only way to interact is through a Web Service. Even the 3rd party solutions they mentioned were really just convenient wrappers around the same type of technology. As it turns out, I'd rather have finer control over the process.
One word of advice: Get a real, external web server. I tried doing this on a non-Server Windows VM on my iMac/MacBook Pro, and it was like pulling teeth! Once I actually got access to an external, full, stand-alone web server, the process was much more streamlined and easy. Do yourself a favor and take that headache out of the equation!
There was a SQL ISAPI extension as part of SQLXML, but I think it has been deprecated: http://msdn.microsoft.com/en-us/library/aa226559%28v=SQL.80%29.aspx
This was effectively a pre-built, and relatively open, web service - so I'm not sure this counts as a direct connection.
You could also check out http://odbcrouter.com/Main
I want to develop a online trading application using silverlight in which I want to perform all the calculations at the client side instead of server.
First, Is it possible to run the whole application on the client side??
Second, How secure is silverlight xap file to prevent decoding the logic??
Please let me know.
Thanks,
Mahesh
You can use Silverlight Out-of-Browser which will increase your access to the local system if that is needed however is is still sandboxed and you do not get full access to system resources. If that is not a concern then you can perform your logic internal to the Silverlight application which remains in the browser and is indeed client side.
In terms of security to your .XAP file is nothing more then a re-branded .ZIP file. If someone can download your .XAP they can then get access to the .DLL's within the .XAP. Obfuscating the DLL's may hinder individuals from getting access to your code see this, however if intellectual property is something on the top of your list, I'd recommend not performing that logic client side as the other post mentions as well.
I've done some cursory reading on Silverlight and data access. From what I can tell, I'll need a web service to hook up a Silverlight application to a database while it's running in browser. Is this true when it goes OOB? Or is there another method that should be used then?
Some background:
We have a .Net 2.0 Winforms application. We're trying to convert the functionality to a web app of some sort without rewriting the business logic. Our internal web developers all write in ColdFusion, so Adobe Air seemed to be a natural fit. However, we've found out that the only way to consume a .Net dll in Air is to write an EXE that makes function calls. (Perhaps something like a WCF service on the local machine.) Since that's the case, I thought I'd see how the data access was in Silverlight OOB, because we will have customers with limited-to-no internet connectivity and will need to be able to access an offline DB.
As far as I know, whether it runs in or out of browser it will need a web service or other means to hit a database. You cannot do it through the Silverlight application because of the sandbox security model used.
In 4.0 there is the added use of COM so you may be able to use that to your advantage.
Otherwise you would just be using a file stored in IsolatedStorage to persist data to, like an XML file for example. Maybe this is what you are looking for though?
I'd like to save some simple text data to a file from my Silverlight app - to a CSV file.
The user presses on a button, the code generates the contents of the file in memory (a string), then a prompt appears asking to either open the file or Save to disk, like through a normal web page.
I found a complicated way to do it:
http://pagebrooks.com/archive/2008/07/16/save-file-dialog-in-silverlight.aspx
But wondered if there was a simpler way? Especially with the recent release of Silverlight 2.0.
Thanks.
Right now Silverlight 2 doesn't support saving directly to the user's disk even with a prompt. It is a feature being considered for future versions, but the work around of having the server push out the data is the current solution.
Just to update this thread -- Silverlight 3 has this capability now.
I do this right now with Silverlight 2.0, but the key is that the files are saved on the web server that hosts the Silverlight apps, by having the Silverlight app call web services.
Probably not what you are looking for, but this is an option.
Silverlight app calls web service, that posts the string
Web service saves the string as a file on the server
File is available through web app, or other means