I need to upload a document to a SharePoint list or folder using the Client Side Object Model from .NET (C#). What is the best way to do this?
The requirements are as follows:
Set metadata values
No limitation on file size
Must work with libraries that exceed the List View Threshold
I have worked out the following code, its working fine.
Thanks,
Sudhakar
For Uploading Document to Sharepoint Document Library use Following function in Client Object Model:
Following link is Also Helpful For you 1) http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx
2)http://msdn.microsoft.com/en-us/library/ee956524.aspx
3)http://www.codeproject.com/Articles/103503/How-to-upload-download-a-document-in-SharePoint-20
Another way is to use the SaveBinaryDirect method. The
SaveBinaryDirect
method use Web Based Distributed Authoring and Versioning (WebDAV) for uploading and downloading files. Without building your own custom WCF service, WebDAV is the most efficient way to upload and download files.Yet another option for uploading a file into a SharePoint site (including SharePoint Online) using File.SaveBinaryDirect Method:
I found that the portion of delax post that updates new file attributes/columns will not work, here is another version that even wroks for a custom infopath library with promoted field: