Creating/copying documents using client side object (javascript)

Hi
I want to the user to press a button and this creates or copies documents (Excel) into a document library on the same site. There are many examples showing how to do this for a list but how can it be achieved for documents?
I've looked at SPFile.CopyTo method but dont know how to use it.
So the source file would have a number of destination files and the name and column data would be altered at time of creation. Looking for a client side javascript solution.
Hope someone can assist.
Thanks

Hi,
According to your description, my understanding is that you want to copy or create excel files into a document library using JavaScript Client Object Model.
For copying excel files, you can use get_files function to get files within a specific folder , and then you can use file collection
push function to copy files and get_name function to get the file name.
Here is a detailed code demo for your reference:
How do I move files from one document library to another using JSOM?
For creating files, you can use Jquery upload plugin to achieve it,here is a detailed code demo for your reference:
How to Upload File to Document Library using JavaScript Client Object Model?
Thanks
Best Regards
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]

Similar Messages

  • Copy one list items new list using client side object model

    Hi,
    I have a requirement like i need to copy one list information to new list with createdby and modified by fields.I need to use client side object model code.Can u please send me the code sample.
    Regards,
    Praveen

    Hi,
    According to your post, my understanding is that you want to copy one list items new list using client side object model.
    You can use console application.
    Here is a similar thread for your reference:
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/28a43891-7505-4d34-b513-fdd66773c2a3/copy-list-item-to-another-list-using-client-object-model-in-console-application?forum=sharepointdevelopmentprevious
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Full mask permission in SharePoint using Client Side Object Model

    Full mask permission in SharePoint using Client Side Object Model does not include all the base permission while it does have all base permission in server side . Is this a bug ? 
    Or do we have any workaround for this.
    BasePermissions.Set(PermissionKind.FullMask);  is not updating all the permissions. 
    It seems that there is some limitation with Microsoft.SharePoint.Client.dll as mentioend at below link . Do we have any workaround here.
    http://break962.rssing.com/browser.php?indx=7116806&last=1&item=9
    Ashish Baranwal || To know what you know and what you do not know, that is true knowledge

    You can write your own loop to upload multiple files via an individual call.
    http://sharepoint.stackexchange.com/questions/108525/multiple-file-upload-with-metadata-using-rest/108532#108532
    More reference: http://sharepointfieldnotes.blogspot.com/2014/04/uploading-documents-and-setting.html
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Import TermSet CSV using client side object model

    Hello,
    I want to import CSV in TermStore using client side object model. Unfortunately there is no ImportManager here.
    Is there any other way (Other than reading from CSV and adding term one by one to term store)?
    Regards, Nanddeep Nachan

    Hi,
    Here is a tool(server-side) from codeplex for your reference:
    SharePoint 2010 CSV Bulk Taxonomy TermSet Importer/Exporter
    If you want to import termsets  from CSV in Client-Side, we can refer the tool above.
    You can develop a windows form application and use .Net Client Object Model to achieve it. The following articles is about how to operate the termset using Client Object Model for you reference:
    http://sundarnarasiman.net/?p=87 (Download)
    http://code.msdn.microsoft.com/office/SharePoint-2013-Synchronize-d40638d1/sourcecode?fileId=72317&pathId=166025385
    http://www.c-sharpcorner.com/Blogs/10853/how-to-create-a-term-set-for-the-specified-group-using-clien.aspx
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Cross Site Collection lookup using client side object model

    I have to do Cross Site Collection lookup using client side object model or Odata ,
    no servier side.. any ideas experts?

    Did you read about cross site publishing feature in SP 2013?
    Check this out
    http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=1038
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2012/09/18/sharepoint-2013-cross-site-publishing.aspx
    http://blog.helloitsliam.com/Lists/Posts/Post.aspx?ID=89
    http://blogs.msdn.com/b/ritazh/archive/2012/09/26/sharepoint-2013-how-to-setup-cross-site-publishing-enable-catalog-use-managed-navigation.aspx
    http://stackoverflow.com/questions/1151036/sharepoint-lookup-column-across-site-collection-boundary
    You will need custom code for this, but since the amount is minimal and this is Stack Overflow I assume that won't be a problem. You will want to make your own listview web part that queries the list using ListViewByQuery. An example can be found here:
    http://blogs.msdn.com/b/ramg/archive/2009/04/21/implementing-a-simple-cross-site-collection-list-view-webpart.aspx

  • How to create a Document Set in SharePoint 2013 using JavaScript Client Side Object Model (JSOM)?

    Hi,
    The requirement is to create ""Document Sets in Bulk" using JSOM. I am using the following posts:-
    http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/1904cddb-850c-4425-8205-998bfaad07d7/create-document-set-using-ecma-script
    But, when I am executing the code, I am getting error "Cannot read property 'DocumentSet' of undefined "..Please find
    below my code. I am using Content editor web part and attached my JS file with that :-
    <div>
    <label>Enter the DocumentSet Name <input type="text" id="txtGetDocumentSetName" name="DocumentSetname"/> </label> </br>
    <input type="button" id="btncreate" name="bcreateDocumentSet" value="Create Document Set" onclick="javascript:CreateDocumentSet()"/>
    </div>
    <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"> </script>
    <script type="text/javascript">
       SP.SOD.executeFunc('sp.js','SP.ClientContext','SP.DocumentSet','SP.DocumentManagement.js',CreateDocumentSet);
    // This function is called on click of the “Create Document Set” button. 
    var ctx;
    var parentFolder;
    var newDocSetName;
    var docsetContentType;
    function CreateDocumentSet() {
        alert("In ClientContext");
        var ctx = SP.ClientContext.get_current(); 
        newDocSetName = $('#txtGetDocumentSetName').val(); 
        var docSetContentTypeID = "0x0120D520";
        alert("docSetContentTypeID:=" + docSetContentTypeID);
        var web = ctx.get_web(); 
        var list = web.get_lists().getByTitle('Current Documents'); 
        ctx.load(list);
        alert("List Loaded !!");
        parentFolder = list.get_rootFolder(); 
        ctx.load(parentFolder);
        docsetContentType = web.get_contentTypes().getById(docSetContentTypeID); 
        ctx.load(docsetContentType);
        alert("docsetContentType Loaded !!");
        ctx.executeQueryAsync(onRequestSuccess, onRequestFail);
    function onRequestSuccess() {       
        alert("In Success");
        SP.DocumentSet.DocumentSet.create(ctx, parentFolder, newDocSetName, docsetContentType.get_id());
        alert('Document Set creation successful');
    // This function runs if the executeQueryAsync call fails.
    function onRequestFail(sender, args) {
        alert("Document Set creation failed" + + args.get_message());
    Please help !!
    Vipul Jain

    Hello,
    I have already tried your solution, however in that case I get the error - "UncaughtSys.ArgumentNullException: Sys.ArgumentNullException:
    Value cannot be null.Parameter name: context"...
    Also, I tried removing SP.SOD.executeFunc
    from my code, but no success :(
    Kindly suggest !!!
    Vipul Jain

  • How to copy a page( webpart page) with its content using client side.

    How to copy a page(in my case  webpart page) with its content(it may contain webparts) using client code (i mean using SPservices or ECMA script).
    What i am planning is ,to give end user a page where it will contain text box to specify  name of page and a button with the help of  content editor webpart.
    where on click of button we need to write client side code such that it should create a new page from a existing page in a library with given name by user.
    Any suggestion would be helpful. For your information we can do it through UI with the help Site Actions / Manage Content and Structure.But i want to automate it using client side code.Server side code is restricted.
    or can we create a template of an existing page with content without the help of sharepoint designer.
    Thanks in advance
    with regards Ravichandra

    This is good example
    http://balajiindia.wordpress.com/2011/05/27/using-jquery-with-custom-web-services-in-sharepoint/
    Create web service
    http://balajiindia.wordpress.com/2011/05/27/using-jquery-with-custom-web-services-in-sharepoint/. Create method "Create Page" http://www.learningsharepoint.com/2010/09/17/create-publishing-pages-sharepoint-2010-programmatically/
    Build your Java Script. You can use Content Editor Web Part if you want to avoid custom web part development http://www.codeproject.com/Articles/544538/JQuery-with-SharePoint
    Oleg

  • What is Sharepoint client side object model ?

    What is Sharepoint client side object model ?

    The client-side object model (CSOM) provides client-side applications with access to a subset of the SharePoint Foundation server object model, including core objects such as site collections, sites, lists, and list items. As described in Data Access for
    Client Applications, the CSOM actually consists of three distinct APIs—the ECMAScript object model, the Silverlight client object model, and the .NET managed client object model—that target distinct client platforms. The ECMAScript object model and the Silverlight
    client object model provide a smaller subset of functionality. This is designed to enhance the user experience, because it minimize the time it takes Silverlight applications or JavaScript functions running in a Web page to load the files required for operation.
    The .NET managed client object model provides a larger subset of functionality for standalone client applications. However, these APIs provide a broadly similar developer experience and work in a similar way.
    You can write both managed client object model code and JavaScript Client Object model code in Visual Studio. As an example, you can create a console application having managed client object model code. Similarly, you may create a Visual Web Part and have
    JavaScript client object model code in it. The JavaScript client object model code can also be directly written inside the SharePoint Designer as well.
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • Error while creating billing document using VF04 transaction

    Hi All,
    User is trying to create billing document using VF04 with ference to delivery number. When pressing save in invoice creation system SAP gives invoice document number (No accouting document generated). but no documents are actually created. When user trying for second time log is showing this sales order is currently processed by the user(user is same who is trying to create invoice)
    Please let us know what is causing this issue since this issue is happening in production and we can not debug this.
    We checked for number range also but its not.
    Waiting for your inputs.
    Regards,
    Jyothi CH.

    When pressing save in invoice creation system
    SAP gives invoice document number (No accouting document generated).
    but no documents are actually created
    Check there is any clash with internal number range of billing type vs other billing types ?
    Try to create billing document using VF01,see any messages were poping while saving ?
    Check for abap dump in ST22 ?
    Edited by: Jeyakanthan A on Feb 9, 2011 9:52 PM

  • I am using Pages 4.3. I created a Document using Pages 4.3 that is 280 MB (it is 350 pages long). Will I be able to open it in Pages 5.0?

    I am using Pages 4.3. I created a Document using Pages 4.3 that is 280 MB (it is 350 pages long). Will I be able to open it in Pages 5.0?

    Hi,
    WARNING
    it´s impossible (for me) to open Pages 5 documents in Pages 4, which is absolutely no go. You can open any f..... word.doc but no pages 4.
    Apple is getting worser every day, it´s a shame. There is no information about this before you buy it.
    So now you have to ask your friends or colleagues to convert a pages 5 document to a word document, so you can open it with pages 4. Hoiw ridiculous is that?
    Pages 5 is a joke. In 5.0 they forgot to manage the task-bar, which came shortly after 4 weeks or so in 5.1.
    The only good: you can run ist parallelly to pages 4.3 but it´s not worth the money.
    APPLE MAKE A  BETTER JOB

  • Create Excise invoice(J1IIN) document while creating billing document using bapi BAPI_BILLINGDOC_CREATEMULTIPLE

    Dear Experts,
    My scenario is:
    We have batch split scenario, where the parent line item of billing document has 0 quantity and its subsequent item (item with batch number) holds actual quantity data.
    When we create billing document using VF01 against delivery document, system creates billing document along with excise invoice document (J1IIN Document). And in excise document contain same number of line items that of billing document. Please see the below attachment: 
    Biiling document screen shot:
    While creating billing document, the J1IIN Document created automatically. Below is the screen-shot for the same.
    Now the issue is:
    When we create billing document using BAPI: BAPI_BILLINGDOC_CREATEMULTIPLE system creating only billing document and not creating excise invoice document.
    When we create excise document manually using J1IIN the zero quantity line items are excluded in excise invoice document.
    Please see the below screen-shot for the same; The z quantity line items are missing.
    We want excise document to be created while creating billing document using BAPI BAPI_BILLINGDOC_CREATEMULTIPLE. Or is there any other BAPI for the same purpose.
    Customization is also maintained for creating excise invoice document automatically.
    Regards,
    Rajesh Sadula.

    HI
      Pricing will be carried basing on the pricing
    procedure.
    Case1: Prices will be carried out automatically if
    necessary condition records are maintained for the
    condition type.
      For this you can go to Sales Order-> Item Conditions
    In the screen you can click on command button Analysis,
    which gives you the list of condition types associated
    to the pricing procedure. By clicking on the condition
    type you can know the action that has taken place.
    Case2: Manually forcing prices for Items.
      To do this, you have to populate ORDER_CONDITIONS_IN &
    ORDER_CONDITIONS_INX. Also note to identify the item
    numbers, you manually pass the item number for each item
    in the sales order, use the same item number for
    populating conditions.
      Parameters required:
    ORDER_CONDITIONS_IN:
      ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
    ORDER_CONDITIONS_INX:
      ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
       Hope the above info helps you. Do revert back if you
    need more info.
    Kind Regards
    Eswar

  • Client side object model examples in sharepoint 2010

    Hi,
    I wanted to learn client side object model in share point 2010.Please provide some urls with examples.
    Regards,
    Praveen

    Hi Praveen,
    here is your links to start with ....explained with examples. :)
    http://www.codeproject.com/Articles/399156/SharePoint-Client-Object-Model-Introduction
    http://zimmergren.net/technical/sp-2010-getting-started-with-the-client-object-model-in-sharepoint-2010
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Create FI documents using both amount in local currency and document

    Hi All,
    I need to create FI documents using both amount in local currency and amount in document using BAPI_ACC_DOCUMENT_POST. Please tell me how to do that.
    Chinmay

    Hi,
    Firstly get the exchange rate, do the calculation using the document currency amount and populate the local currency amount field.
    Whenever you use BAPI, use BAPI_TRANSACTION_COMMIT to commit the changes.
    Thanks & regards.

  • Create delivery document using bapi_deliveryprocessing_exec

    Can any one send me the sample code to create delivery document using BAPI_DELIVERYPROCESSING_EXEC BAPI.

    Hi,
    Use the fm:     'SHP_VL10_DELIVERY_CREATE_PARA' for creatting the delivery.
    The below code creates the delivery document:
    *& Report  ZSTATUS
    REPORT  zstatus.
    DATA: t_vbak LIKE vbak   OCCURS 0 WITH HEADER LINE.
    DATA: t_vbap LIKE vbapvb OCCURS 0 WITH HEADER LINE.
    DATA: t_vbep LIKE vbepvb OCCURS 0 WITH HEADER LINE.
    DATA: t_vbkd LIKE vbkdvb OCCURS 0 WITH HEADER LINE.
    DATA: t_vbpa LIKE vbpavb OCCURS 0 WITH HEADER LINE.
    DATA: t_vbuk LIKE vbukvb OCCURS 0 WITH HEADER LINE.
    DATA: t_vbup LIKE vbupvb OCCURS 0 WITH HEADER LINE.
    DATA: t_vbfa LIKE vbfavb OCCURS 0 WITH HEADER LINE.
    DATA: c_vbfa LIKE vbfavb OCCURS 0 WITH HEADER LINE.
    DATA: ls_sd_keys     TYPE sales_key.
    DATA : key      TYPE shp_sales_key_t,
           sd_order TYPE shp_vl10_sd_order.
    p_vbeln(sales doc no) = '5000006100'.
      AT END OF vbeln.
        REFRESH: t_vbak, t_vbap,
                 t_vbep, t_vbkd,
                 t_vbpa, t_vbuk,
                 t_vbup.
        CLEAR : t_vbak, t_vbap,
                t_vbep, t_vbkd,
                t_vbpa, t_vbuk,
                t_vbup.
        REFRESH: key.
        ls_sd_keys-vbeln = p_vbeln.
        APPEND ls_sd_keys TO key.
        CLEAR:ls_sd_keys.
        CLEAR: sd_order.
        CALL FUNCTION 'SHP_GET_SD_DATA'
          EXPORTING
            it_vbak_key = key
          CHANGING
            cx_sd_order = sd_order.
        APPEND LINES OF sd_order-vbak TO t_vbak.
        APPEND LINES OF sd_order-vbap TO t_vbap.
        APPEND LINES OF sd_order-vbep TO t_vbep.
        APPEND LINES OF sd_order-vbuk TO t_vbuk.
        APPEND LINES OF sd_order-vbup TO t_vbup.
        APPEND LINES OF sd_order-vbkd TO t_vbkd.
        APPEND LINES OF sd_order-vbpa TO t_vbpa.
        APPEND LINES OF sd_order-vbfa TO c_vbfa.
        LOOP AT c_vbfa WHERE vbtyp_n = 'J'.
          MOVE c_vbfa TO t_vbfa.
          APPEND t_vbfa.
          CLEAR t_vbfa.
        ENDLOOP.
        CLEAR: sd_order.
        CLEAR: key.
        CALL FUNCTION 'SHP_VL10_DELIVERY_CREATE_PARA'
          EXPORTING
            if_ledat              = sy-datum
            if_nur_vorgabe_pos    = ' '
          TABLES
            it_vbak               = t_vbak
            it_vbap               = t_vbap
            it_vbep               = t_vbep
            it_vbuk               = t_vbuk
            it_vbup               = t_vbup
            it_vbkd               = t_vbkd
            it_vbpa               = t_vbpa
           it_vbfa               = t_vbfa
          EXCEPTIONS
            system_failure        = 1
            communication_failure = 2
            RESOURCE_FAILURE      = 3
            OTHERS                = 4.
        IF sy-subrc = 0.
       WRITE:/ 'delivery completed'.
        ENDIF.
      ENDAT.
    If it is helpful rewards points.
    Regards
    Pratap.M

  • Getting error while trying to create a document using oracle web ADI resp.

    Hi All,
    When I am trying to create a document using Oracle Web ADI Responsibility and using "Ben Ri Process Bnf" integrator, it is showing me error
    "The following error has occurred
    Exception Name: oracle.apps.bne.exception.BneParameterException - No parameter list definition at parameter list id 800:PER_RI_JPG_PARAM_LIS
    Log File Bookmark: 868035"
    Can anybody tell me the cause of this error?
    Thanks.

    Please see the solution in (The Descriptive Flexfield With Application Name Receivables (AR) and Name Party Site Information (HZ_PARTY_SITES) Is Not Frozen [ID 743262.1]).
    Thanks,
    Hussein

Maybe you are looking for