Upload multiple documents to SharePoint library in parallel using c#

Hi Team,
We are trying to upload thousands of documents to SharePoint library programatically.I am able to achieve this sequentially . Please help me in achieving this parallely and improve the performance.
Thanks in Advance.

You can try new .net framework async/await feature as described at
http://blogs.msdn.com/b/cdndevs/archive/2013/12/18/c-async-and-await-why-do-we-need-them-part-1.aspx. However, you need to limit your concurrent requests, you don't want to span 100 files upload in parallel.
Thanks,
Sohel Rana
http://ranaictiu-technicalblog.blogspot.com

Similar Messages

  • Uploading multiple documents into sharepoint list item with REST in sharepoint 2013 using content editor web part :

    hi ,
    i am trying to upload multiple document files into sharepoint list item. I followed below link for implementaion.
    http://techfindings-prem.blogspot.in/search/label/jquery.multifilejs
    It was working for sharepoint hosted app.
     This complete code is written within content edito web part.
    It was working when i was in root site collection with below change (hard coded the root level url) in code in "UploadFile" function.
    var scriptbase = "http://servername" + "/_layouts/15/";
                console.log(' File size:' + bytes.length);
                $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    But the issue came in picture when i was working with the other site collection instead of root one. The url was like below.
    "http://servername/sites/cpg/". This time i need to be there within "cpg" site collection. 
    Now if i hard code the url as i did above my code gets break here while come to below line
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
    I am getting error when i used below code:
    var scriptbase = "http://servername" + "/_layouts/15/";
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    Please hekp in this case. This complete code is written within content edito web part. 
    Regards:
    Sanjay Joshi

    Hi,
    According to your post, my understanding is that you have an issue about upload multiple documents files into library vai REST API.
    As you have said, you have used the hard code url in your code.
    How about use the _spPageContextInfo.webAbsoluteUrl method to get the url?
    I have used this method to get the url, then use the code in the article you have pasted within a content editor web part to upload the files.
    You can replace the hard code url with the _spPageContextInfo.webAbsoluteUrl method, then check whether it works.
    Thanks,
    Jason
    Jason Guo
    TechNet Community Support

  • Upload Multiple documents in SharePoint document Library not working

    Hi All,
            I have folder on my desktop which consists of nested folders and files(Total 11 files) .And when I select "Upload multiple files" option to upload documents and drag the folder from the desktop in pop-up window .
             The sharepoint document library uploads only 1 file among all the nested folders from 11 files.Can any one help me how can I solve this
    Thanks, Quality Communication Provides Quality Work. http://siddiq-sharepoint2010.blogspot.in/ Siddiqali Mohammad .

    Hi,
    I understand you encountered the issue when use "Upload Multiple Documents" to Drag Files and Folders to upload window.
    When you say "The sharepoint document library uploads only 1 file among all the nested folders from 11 files", do you mean you have drag all files and folders to the window, while only 1 file is uploaded sucessfully? Or you cannot find all expected
    folders and files?
    Please manually open "Windows Explorer" to locate files and drag files from "Windows Explorer", instead of using the "Open window"
    opened by "Browse for files instead" as below:
    Regards,
    Rebecca Tu
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Can't see 'Upload Multiple Document' option in sharepoint 2013

    After upgrading Sharepoint 2010 to 2013, i can't see 'Upload Multiple Document' option under files tab. I have downloaded and place the file 'STSUPLD.DLL' into Office14 and Office15 folder but IE is not asking me to run any microsoft ActiveX control as mentioned here
    http://thuansoldier.net/?p=2289
    I am using  Office 2010 with IE9 (32 bit) .
    Am i missing anything ?

    Hi, 
    According to your post, my understanding is that you could not see the “Upload Multiple Document” option in SharePoint 2013.
    In SharePoint 2013 the “Upload Multiple” Options has been depreciated. As we all known, there are two alternative ways to Upload multiple documents:option
    1 -  Using the drag-and-drop functionality, option 2 - Windows Explorer view.
    You can upgrade your IE from IE9 to IE10 then check whether it works.
    You can also use the Windows Explorer view to upload multiple documents.
    You will probably get the following error.
    To resolve this add the SharePoint site as Trusted in your Browser and Make sure that the WebClient service is running. To do this, follow these steps:
    Click Start, click Run, type services.msc, and then press Enter.
    In the list of services, locate the WebClient service, and then make sure that its status in the Status column is set to Started. If its status is not set to Started, double-click WebClient, click Start, and then click OK.
    Once done restart the browser and try opening the Windows Explorer again. In the Windows Explorer you can copy and paste Multiple documents as done in earlier SharePoint versions.
    For more information:
    http://www.learningsharepoint.com/2012/11/29/how-to-upload-multiple-documents-in-sharepoint-2013/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Upload multiple documents option is not visible for one user in SharePoint 2007.

    Hi,
    For one user Upload multiple documents option is not visible.
    We are using SharePoint 2007 environment.
    User is using IE 9 32 bit,Office 2010.
    I did repair office 2010.
    Active x controls are enabled.
    Please anyone help me on this.
    Thanks,
    Ashok

    Hi,
    According to your post, my understanding is that after client upgraded to Office 2013 the option for Upload multiple document was grayed out.
    I try to reproduce the issue in my environment, however everything works well.
    My configuration of system is:
    Windows 8.1;
    IE11;
    Office 2013 32bit.
    Please repair the Office 2013 to check whether it works.
    In addition, there are many thing you need to check. Please refer to:
    http://sharepointknowledgebase.blogspot.com/2013/09/upload-multiple-documents-is-disabled.html
    Here is a similar thread for your reference:
    http://social.msdn.microsoft.com/Forums/en-US/1a5af332-ed21-41ee-bf64-9122a7439623/sharepoint-not-activating-stsuplddll-upload-mutliple-documents-greyed-out?forum=sharepointgeneralprevious
    More information:
    "Upload Multiple Documents" is disabled in Document Library
    SharePoint 2010 : How to Enable Uploading Multiple Documents Functionality
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Uploading Multiple Documents To a List Item sharepoint 2010

    hi Guys ,
    Is there a way we can enable (out of the box )Uploading Multiple Documents To a List Item sharepoint 2010 ?
    cheers

    No, There is no OOB way to do the same you have to build a custom Page/Control OR customise OOB Form to attache multiple files and that will be through integration of ajax based control (multiple file uploader.)
    the other way to do the same is provision a custom field. we have done this for our many  clients.
    Hi, I also encountered the same problem, could u pls provide detailed information by a custom field?

  • Help Required - Upload Multiple Documents functionality sometimes disappears in SharePoint 2010

    Hi All,
    We have a web application created in SharePoint 2010 & there we were facing an issue of not able to Upload multiple documents. After doing search on google, we have found that
    pre-requisites for this functionality to be working properly are as follows:
    Client Integration needs to be enabled for the web application.
    The STSUpld.UploadCtl IE add-in must be enabled. (located in C:\Program Files (x86)\Microsoft Office\Office12)
    The 32 bit version of Internet Explorer. The 64 bit version does not support it and neither do other, non IE, browsers.
    Office 2003 or newer on the client.
    After meeting all the above requirements, We are now able to see the Upload Multiple Documents link but we are failing in below 2 scenarios:
    On some machines it is working fine & on some it is not.
    On some machines, this option is available for sometime & sometimes it disappears.
    If any one of you have experienced the same problem, then please help us with your valuable suggestions & possible solution for it.

    Hi Manish,
    We've just been experiencing your initial issue with Office 2007 clients not being able to use the multi-file upload functionality.  Sure enough....turning on presence information in Central Admin fixes the issue.  The strange thing is though that
    when presence is turned off, Office 2003 and 2010 clients still work fine and it's only 2007 clients that fail.  Also this issue appeared to only exist for us inside applications that have been upgraded from MOSS2007 to SP2010.  Any new applications
    of even new site collections within an upgraded application worked fine across all 3 Office versions.
    Coincidently, we're also experiencing the more recent issue you've come across with files not uploading after clicking OK in the ActiveX.  Nothing happens.  Office 2010 clients work fine but 2003 and 2007 clients just don't upload the selected
    files.  We've found a workaround which "fixes" the issue but brings it's own set of problems so it's not ideal.  Here's what we've done...
    1. Open IIS, and navigate to the web where you want to use multi-file upload
    2. Select Handler Mappings and Add Script Map
    3. Set Request Path - shtml.dll
    4. Set Executable - C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\SHTML.dll
    5. Set the name to something meaningful - Multi File Upload
    6. Leave the Request Restrictions as default
    This should fix the issue with files not uploading but unfortunately it also prevents SharePoint Designer from accessing the site.  For the application where we desperately need multi-file upload we can manage without SPD access so it's not the end
    of the world but not ideal.  We've actually got an outstanding incident logged with Microsoft to resolve this issue but they've yet to find a solution for us.  We suggested to MS that we update authentication to Kerberos from NTLM and retry as we
    seem to be getting 401 errors in the call stack so thought that could be related.  We've not yet configured Kerberos so I'm not sure whether this is a solution or not.
    One other point worth mentioning is that SharePoint Designer 2010 (which is free) installs the latest version (14) of the Upload ActiveX and with this installed the uploads work as expected.  Also if you have Silverlight and SPD2010 installed then you
    get a Silverlight control to do the upload which also works fine.  Again, not ideal as rolling out SPD 2010 to affected clients isn't really a suitable solution.
    Sorry I can't be any more help.  Hopefully my findings might point you in the right direction.  If you do find a solution (other than the IIS handler mapping) then please re-post here,
    Good luck,
    Ben

  • Getting error while uploading multiple files in sharepoint hosted app in 2013 with REST API

    Hi All,
    In one of my tasks, I was struck with one issue, that is "While uploading multiple files into custom list with REST API".
    Iam trying to upload multiple files in library with REST calls for an APP development, my issue is if i wants to upload 4 image at once its storing only
    3 image file and further giving "Conflict" error". Below is the attached screenshot of exact error.
    Error within screenshot are : status Code : 409
    status Text :conflict
    For this operation i am uploading different files as an attachment to an list item, below is the code used for uploading multiple files.
    my code is
    function PerformUpload(listName, fileName, listItem, fileData)
        var urlOfAttachment="";
       // var itemId = listItem.get_id();
        urlOfAttachment = appWebUrl + "/_api/web/lists/GetByTitle('" + listName + "')/items(" + listItem + ")/AttachmentFiles/add(FileName='" + fileName + "')"
        // use the request executor (cross domain library) to perform the upload
        var reqExecutor = new SP.RequestExecutor(appWebUrl);
        reqExecutor.executeAsync({
            url: urlOfAttachment,
            method: "POST",
            headers: {
                "Accept": "application/json; odata=verbose",
                "X-RequestDigest": digest              
            contentType: "application/json;odata=verbose",
            binaryStringRequestBody: true,
            body: fileData,
            success: function (x, y, z) {
                alert("Success!");
            error: function (x, y, z) {
                alert(z);

    Hi,
    THis is common issue if your file size exceeds 
     upload a document of size more than 1mb. worksss well for kb files.
    https://social.technet.microsoft.com/Forums/office/en-US/b888ac78-eb4e-4653-b69d-1917c84cc777/getting-error-while-uploading-multiple-files-in-sharepoint-hosted-app-in-2013-with-rest-api?forum=sharepointdevelopment
    or try the below method
    https://social.technet.microsoft.com/Forums/office/en-US/40b0cb04-1fbb-4639-96f3-a95fe3bdbd78/upload-files-using-rest-api-in-sharepoint-2013?forum=sharepointdevelopment
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Uploading Multiple documents to custom list programmatically

    HI,
    I am using VS 2010 and C#, SharePoint 2010.
    I have a custom list ( not using document library).
    I am using a visual web part, in which i have added a asp:file upload control, which has Allow multiple set to true.
    How to upload multiple files to custom list programmatically using the asp:file upload control?
    Thanks

    See if any of the below links give you some pointers
    http://kamilamirul.wordpress.com/2013/01/19/multiple-upload-file-programmatically-using-gridview/
    http://nestorrg-blogs.itequia.com/2010/01/upload-multiple-files-attached-to.html
    http://social.technet.microsoft.com/wiki/contents/articles/2990.programatically-upload-multiple-file-in-sharepoint-list-part-2.aspx
    http://www.c-sharpcorner.com/UploadFile/Freddy_Khalaf/multiple-attachment-custom-control-in-sharepoint/
    http://www.c-sharpcorner.com/UploadFile/sarav82/MOSS11072007065009AM/MOSS.aspx
    Geetanjali Arora | My blogs |

  • Getting error while uploading a document in a library

    Hi,
    I'm getting a weird error while uploading the document in the library. And I don't get it all the times but most of the times.
    It reads:
    The file <library name>/<file name> has been modified by i:0#.<user-id> on <datetime stamp>
    How to resolve this ? I have referred many articles on this one, but none helped.
    Thanks for your response in advance.
    Regards

    Hi Prajk,
    Based on your description, I recommend to check if there are any ItemAdded event receiver or workflows which are triggered when an item is created to update the document properties in the library.
    If there is any ItemAdded event receiver on the library, I recommend to wait for ItemAdded to finish before the ListFieldIterator control residing on EditForm.aspx loads (It’s the ListFieldIterator which displays the Item’s fields ).
    http://blogs.msdn.com/b/manuj/archive/2009/09/22/itemadded-event-on-document-library-the-file-has-been-modified-by-on-error.aspx
    If there is any workflow on the library, I recommend to add a Pause for Duration step at the beginning of the workflows.
    If above cannot work, please check ULS log for detailed error message.
    For SharePoint 2013, by default, ULS log is at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • STSUPLD.DLL not recognizing as an add-on; upload multiple documents disabled

    On my client system, Windows XP, Office 2007 and IE8 is installed. It is a 32 bit system. On the Sharepoint site, "upload multiple document" feature is disabled. After searching for the cause, I came to know about the STSUPLD add-on that needs
    to be enabled otherwise it remains greyed out. So I copied the DLL file to C:/.../Office12/STSUPLD.DLL
    IE does not detect any add-on when I start a new browser session. Between copying the DLL, and starting a new browser session, followed by checking Tools-->manage add-ons, am I missing an important step? (like installing...etc.)
    Thanks

    easy way is, if you can install the Office client on the server, the control will be available.
    also check this post for further detail:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/1a5af332-ed21-41ee-bf64-9122a7439623/sharepoint-not-activating-stsuplddll-upload-mutliple-documents-greyed-out?forum=sharepointgeneralprevious
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • I get two screens while uploading a document in a library

    Hi,
    I get two upload screens while uploading a document to a library. Take a look at the below screenshots. Can somebody please tell me how can I club these two to one.
    I need only one upload screen with all the metadata listed.
    Many thanks for your response.
    p.s. also please tell me an out of the box way to do this. Even scripting is okay.
    1.
    2.

    In the first screenshot I can see the link "Upload files using Windows Explorer instead". You can use that option to upload your files and the default values for metadata would be taken for those files. 
    From the second screenshot I can see there are custom columns in metadata because of which the second dialog is shown. If there are no custom columns in metadata then the second dialog will not appear.

  • Search text in document of sharepoint library

    I am trying to write a program which will fetch the word document from sharepoint library and check if a metadata(term set) e.g.
    "Movies" exists in the document or not. I need to know if there is any way I can read a document? Currently I get search to use interop assembly. I have to download the document on the server for that, Is there any other way in which I can read document
    from the library itself without downloading and check if the word "Movies" is present in it. Using Sharepoint 2013.

    hi
    the way you choose is too complicated: you will need to open the documents by yourself programmatically and analyze its content. Standard Sharepoint search crawler is already integrated with Office documents (and in 2013 version with pdf without additional
    configurations), i.e. when it crawls the content it checks not only documents names but also content inside these documents.
    So if you only need to display list of documents based on the search query, use OTB search. If you need to do something with the search results programmatically, you can make search queries programmatically and then process the returned items in the code
    (see e.g.
    Programmatically working with Keyword Search Queries in SharePoint 2013).
    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

  • Can Contributors access Visio documents in SharePoint library

    Hi,
    Can site contributors view / edit Visio documents in SharePoint library?
    Please anyone help me on this.

    How can I do this :Also try visio
    /safe and deactivate any addons.
    Can you please give me detail steps?

  • (409) Conflict Error while uploading the file into Sharepoint library

    Getting the below error while uploading the file into Sharepoint library.
    (409) Conflict. at System.Net.HttpWebRequest.GetResponse() at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() at Microsoft.SharePoint.Client.File.SaveBinary(ClientContext context, String serverRelativeUrl,
    Stream stream, String etag, Boolean overwriteIfExists
    I have used the below code:
    ClientOM.File.SaveBinaryDirect(clientContext, "/Shared%20Documents/NewDocument.pptx", memoryStream, true);
    Thanks in advance.

    May be issue is with path.
    https://server/ should be there instead of
    subsite path(https://server/path/path)
    in the client context
    Check the below link
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/fbb38b10-1127-48a6-a65f-0301edd766c4/the-remote-server-returned-an-error-409-conflict-error-while-uploading-files-to-sharepoint?forum=sharepointdevelopmentlegacy

Maybe you are looking for

  • How to write Sync service in ABAP

    Dear Experts,               i m very new to ABAP dev, can anybody help me how to write a sync service in ABAP and how to call a function module in to that sync service.                My requirement is i want to upload the data from the clint and dow

  • How to Turn Off the Pop Up Blocker;

    My Pop Up Blocker has been set. I need to use a site that requires the blocker to be turned off. Where is it and how do I turn it off?

  • Installed updated Flash Player but still doesn't work

    I have Windows Vista 32 bit.  I was promtped to update my adobe flash player so I did.  I installed the updated version of adobe flash player for internet explorer but it still won't work for me.  I tried the Troubleshoot Flash Player information on

  • Adobe Flash Player - Uninstall problem

    I have a new HP Pavilion f0010 laptop.  Was having problems with videos being "green".  Did some online researching and somehow accidentally uninstalled Adobe Flash Player from control panel.  How do I reinstall this to original installation?  Thanks

  • BT Netprotect/McAfee Java update causing repeated ...

    This morning McAfee downloaded a Java update. Since then, almost every webpage or like I open triggers a notification asking "Do I want the following programme to make changes to my computer?". The programme it refers to is Java. I could change my co