Upload multiples attachments in sharepoint list programmatically

Hi sir,
I want To upload multiple attachments in sharepiont list programmatically.plesse suggest me
vijay

Hello,
The TechNet Sandbox forum is designed for users to try out the new forums functionality. Please be respectful of others, and do not expect replies to questions asked here.
As it's off-topic here, I am moving the question to the
Where is the forum for... forum.
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book:
Windows PowerShell 2.0 Bible
My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

Similar Messages

  • 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 |

  • Upload multiple attachments in sharepoint 2010 list

    I want to have multiple attachment column in sharepoint list.is there any way to have this?
    I have one list and now I want to create a scenario that at a time user can attach more then one file like they do in Gmail.
    Can I achieve this using SharePoint 2010 list?

    Yes, those links for server object model.
    You can also do same with client object model:
    http://withinsharepoint.com/archives/111
    http://ranaictiu-technicalblog.blogspot.in/2010/06/sharepoint-2010-attach-files-to.html
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • 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

  • 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?

  • 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

  • Upload Excel data to Sharepoint list VIA infopath form

    Hi,
    I'll try to explain the process of what I want to do first.
    1. In Excel
    I have an exceldocument (XLS, XLSX or XLSM) with 4 named columns and a named worksheet saved locally on my computer.
    I want to upload this data into preferably a custom list in sharepoint but it needs to run via a infopath template first.
    2. In Infopath
    The Infopath template will prompt the user to specify values in 2 additional fields.
    After giving input to these fields user may browse for the locally stored excel document and upload the document.
    In the same infopath template a dynamic array should be visible containing 6 columns (4 from excel + 2 from headerlevel of template) and the amount of rows based on the number of rows from excelsheet.
    At the end of template a submit button is found for uploading the entire array into sharepoint custom list.
    Is this possible to do at all?
    NOTE! End user should not have to save the excelsheet as XML file nor do a XML mapping.
    Infopath should, perhaps with help of VBA read excelsheet and transfer data to correct destination in sharepoint on it self.
    Looking forward to your reply

    Hi Jonas,
    You can attach your Excel doucment into InfoPath form and send InfoPath form to a custom web service. Then you can parse the Excel data and combine the Excel data and additional fields into SharePoint list in the customized  web service.
    For more information, you can have a look at the thread:
    http://dandeng.blogspot.com/2012/03/submit-infopath-form-data-to-web.html
    http://www.codeproject.com/Articles/88547/Submit-entire-InfoPath-form-to-web-service
    https://social.msdn.microsoft.com/Forums/office/en-US/590f1e78-5c08-47bd-8af4-9709102b568d/webservice-to-send-attachments-in-infopath-form-to-different-location?forum=sharepointcustomization
    https://msdn.microsoft.com/en-us/library/office/gg575571.aspx?f=255&MSPPError=-2147217396
    Best Regards,
    Eric
    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]

  • Delete Attachments from SharePoint list

    Hello, 
    I created InfoPath Form, and users can attach a file. I want to delete the attachments from the SharePoint list after a while (Privacy issues). How can I do it? I searched about it and I found some codes but I'm not sure how to use them. Could anyone help
    me? 
    Thank You
    Dan

    Hi Gary,
    I would like to suggesting to used Event Receiver on that List. 
    below example of how to create event receiver on list?
    CREATING
    EVENT RECEIVER IN SHAREPOINT 2010
    another link to showing all method of  SPItemEventReceiver
    event handler. you can used `ItemAdded`
    or `ItemAttachmentAdded` override method to listItem.
    SharePoint Event Handlers
    Than used @Yaoyao Chen's Code.
    code :
    public override void ItemAdded(SPItemEventProperties properties)
    SPListItem item= properties.ListItem;
    List<string> fileNames = new List<string>();
    foreach (string fileName in item.Attachments)
    fileNames.Add(fileName);
    foreach(string fileName in fileNames)
    item.Attachments.Delete(fileName);
    item.Update();

  • 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]

  • Unable to update SharePoint List Programmatically in SharePoint Online - Anonymous Login

    We are unable to programmatically update SharePoint lists with Anonymous access in Office 365 - SharePoint Online site. That is, in a public facing SharePoint Online Site, we have a Contact Us Page and when submitted, we would like to store that item in
    a List and then also a trigger an e-mail notification? We are unable to do that using SPServices or CSOM because the code is not firing as the user is logged in anonymously. How do we do this?
    Karthick S

    Naveen,
    I tried this solution and I am getting correlation error .Can you please check this?
    Error is:
    "Web Part Error: Solution failed validation. Correlation ID: e225e49c-c008-1000-ae6e-eeb998cf42af."

  • Copy Attachments of sharepoint list item to a document library using Javascript on click of a button

    The requirement is as follows:
    1. We have a SP list. All items in the list have mulitple attachments.
    2. On click of a button, All the attachments of all items should be copied to a document library
    This is to be done from client side only. No server code is acceptable. We have tried following things:
    1. USing Asynch call
    context = new SP.ClientContext("my site name");
             this.oWebsite = context.get_web();
             var lists = oWebsite.get_lists();
             var list = lists.getByTitle('my list name');         
             context.load(oWebsite);
             var folderPath = 'Lists/<my list name>/Attachments/' + folderId;
             var Folder = oWebsite.getFolderByServerRelativeUrl(folderPath);
             context.load(Folder);
             Files = Folder.get_files();
             context.load(Files);
             context.executeQueryAsync(Function.createDelegate(this, this.ExecuteCopyOnSuccess), Function.createDelegate(this, this.ExecuteCopyOnFailure));
    function ExecuteCopyOnSuccess(sender, args) {        
             for(var p=0;p<this.Files.get_count();p++)
         var file = Files.itemAt(p);    
              var filename = file.get_name();      
              if (filename != null) {
                  var newUrl = 'document library url';
                  file.copyTo(newUrl, true);
                  context.executeQueryAsync(null,null);
    In this case, Files.get_count() throws error - The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
    2. Using copy.asmx service
    It copies files to document library but some files are blank and are having size 0.
    Thanks!

    Hi,
    I think you can use Document Content types or document sets -
    Here are links that you can refer to
    http://office.microsoft.com/en-us/windows-sharepoint-services-help/introduction-to-content-types-HA010121570.aspx
    http://msdn.microsoft.com/en-us/library/office/ms472236(v=office.14).aspx
    http://office.microsoft.com/en-us/sharepoint-server-help/create-and-configure-a-new-document-set-content-type-HA101782461.aspx
    http://office.microsoft.com/en-us/sharepoint-server-help/introduction-to-document-sets-HA101782466.aspx?CTT=5&origin=HA101782461
    Hope this helps!
    MCITP: SharePoint 2010 Administrator
    MCTS - MOSS 2007 Configuring, .NET 2.0
    | SharePoint Architect | Evangelist |
    http://www.sharepointdeveloper.in/
    http://ramakrishnaraja.blogspot.com/

  • 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

  • Upload multiple attachments

    Hi,
    I use the below code to add attachments to Siebel FS - I would like to add all the files under a specific directory as attachment to a specific parent (case) record.
    This code adds one specific file successfully - but need to know how to do the same for multiple files at one shot.
    thanks.
    Venkat.
    function WebApplet_PreInvokeMethod (MethodName)
         if (MethodName == "PutFileNow")
                   var oBO = TheApplication().ActiveBusObject();
                   var oBC = oBO.GetBusComp("HLS Cases Attachment");     
                   var RetValue;
                   oBC.NewRecord(NewAfter);
                   RetValue = oBC.InvokeMethod ("CreateFile", "C:\\test.JPG","HLSFileName","N");
                   oBC.WriteRecord();
                   return(CancelOperation);
         return (ContinueOperation);
    --------

    What you can do is to make a system call with a good old dir command where you pipe the output to a file and the read the file afterwards.
    Have a look at:
    Clib.system
    Clib.fopen
    Clib.fgets
    Clib.fclose
    Axel

  • Attach multiple files to a List Item in SharePoint 2013

    Hi Guys,
    I have a customer that want to attach multiple files to single list item in a dialog box. like Datasheet View, if we set up a Datasheet View and click on the Attachment cell, it opens a dialog box that allow to select and attach multiple files as one operation. 
    Does anyone know how to solve this issue?
    As we know, if we want to attach multiple files, it only allow me to attach one file at a time, then repeat this process for every other file.
    Thanks in advance!
    Jodie

    Hi,
    According to your post, my understanding is that you wanted to upload multiple files in SharePoint list.
    There is no out of the box way to accomplish this with SharePoint.
    You can refer to the following articles to achieve it programmatically.
    Multiple Upload File Programmatically Using GridView:
    http://kamilamirul.wordpress.com/2013/01/19/multiple-upload-file-programmatically-using-gridview/
    Upload multiple files attached to a SharePoint list item.
    http://nestorrg-blogs.itequia.com/2010/01/upload-multiple-files-attached-to.html
    Programatically Upload Multiple File in SharePoint List
    http://social.technet.microsoft.com/wiki/contents/articles/2990.programatically-upload-multiple-file-in-sharepoint-list-part-2.aspx
    Programmatically uploading multiple files to Custom sharepoint list 
    http://www.c-sharpcorner.com/UploadFile/sarav82/MOSS11072007065009AM/MOSS.aspx
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • 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

Maybe you are looking for

  • Standard View in ALV

    Hi All, How to lock the Standard View of ALV. i.e. user should not be able to edit standard View but he should be allowed to add or updated new Views. Thanks, Feroz

  • Connection Key in Discoverer URL

    Requirement is to form discoverer URL dynamically So that once user clicks a button url is called and discoverer can login to DISCO OLAP. Connection key forms a part of discoverer OLAP URL . Pls. let me know the query for retrieving connection key fr

  • E71 - Problems with dictonary and languages instal...

    Hi to everybody! I have a problem with my dictonary but I can't find a solution. My firmware version is 110.07.127 09-10-2008 rm-346 nokia e71-1 (17). My default pre-installed language is English. I have installed 2 languages in the memory card: Ital

  • Extracting a string

    Hello  I have a list with content  Joe DOH (JD:45)  Chris Jones (CJ:47)  Angela K. Macon (AKM:38) How to recover for each item only the name ?, ignoring what is in the brackets.  Joe DOH   Chris Jones   Angela K. Macon Thanks

  • Inicio sesion

    Hi, I couldn´t see my start session Username and pass. Any idea where I can change this settings? Thanks