A collegue in the office was having some problems with uploading documents into a library. The thing was, he was getting errors when he uploads something bigger than 3mb.
So we tried to change web.config of the site, upload size, maxpacketlength etc. They were all looking correct, and the site collection was not loaded completely.
I guess because of the inexperience of using client object model we could not find the answer fast. It took 2 days lol
Nevermind, client object model allows you to upload Binary file directly, you will have NO problems but, Silverlight Api does not have that function, which is:
Microsoft.SharePoint.Client.File.SaveBinaryDirect
So,
If you are having problems with uploading files to the library with Silverlight or WPF Applications, then you should use,
SPWebService contentService = SPWebService.ContentService;
contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = int.MaxValue;
contentService.Update();
26 Temmuz 2011 Salı
WP7 Sharepoint 2010 Lists and Client Object Model
I was developing an Windows Phone 7 application today. As you may know WP7 does not support authentication for NTLM. The only thing you can do (as I know, I am still open for new recommendations) is form based; in which you have to add login information to the request header.
The thing i was doing was using client object model. Actually I could not handle anything, I tried Authentication.asmx and try to get some cookie from there, but I was not able to authenticate myself (because the firm's form based settings were corrupted, and i guess they did not want to create this settings again, and continued with NTLM)
So I added references (Microsoft.Sharepoint.Client and *.Runtime) and created a ClientContext class as:
(ClientContext context = new ClientContext("urlhere"))
Added necessary credentials as:
context.Credentials =
new System.Net.NetworkCredential("username", "pass", "domain");
Fetch my data from a WebService that I created and installed to IIS (You have to create an Empty Asp.Net project, add a web service, build it, and Add an Application to your Site in IIS, show the directory of the ASP.NET project)
Everything was going perfect afterwards, I was able to get data but, sometimes I was seeing this error message:
"The underlying connection was closed: A connection that was expected to be kept alive was closed by the server."
So after a little research I figured it out, this error is caused by WebRequest, which does not close itself after ClientContext.ExecuteQuery() function.
So solution I found was adding this little magical line:
using(ClientContext context = new ClientContext("url"))
{
context.PendingRequest.RequestExecutor.WebRequest.KeepAlive = false
The thing i was doing was using client object model. Actually I could not handle anything, I tried Authentication.asmx and try to get some cookie from there, but I was not able to authenticate myself (because the firm's form based settings were corrupted, and i guess they did not want to create this settings again, and continued with NTLM)
So I added references (Microsoft.Sharepoint.Client and *.Runtime) and created a ClientContext class as:
(ClientContext context = new ClientContext("urlhere"))
Added necessary credentials as:
context.Credentials =
new System.Net.NetworkCredential("username", "pass", "domain");
Fetch my data from a WebService that I created and installed to IIS (You have to create an Empty Asp.Net project, add a web service, build it, and Add an Application to your Site in IIS, show the directory of the ASP.NET project)
Everything was going perfect afterwards, I was able to get data but, sometimes I was seeing this error message:
"The underlying connection was closed: A connection that was expected to be kept alive was closed by the server."
So after a little research I figured it out, this error is caused by WebRequest, which does not close itself after ClientContext.ExecuteQuery() function.
So solution I found was adding this little magical line:
using(ClientContext context = new ClientContext("url"))
{
context.PendingRequest.RequestExecutor.WebRequest.KeepAlive = false
Kaydol:
Kayıtlar (Atom)