Create Folder and add document in library located in another sub-site using javascript or jquery.

Gadhiya, Jenis 21 Reputation points
2022-05-17T06:19:29.553+00:00

I am trying to create a folder by creating a client request to another subsidiary, but no method works for me.

-> http://......./subs/spain/installationdatabase/pages/installationupload.aspx
Here is my javascript file and I want to create a new folder and upload selected documents whenever I press a button on this site.

-> https://...../subs/spain/databackup/Data-backup
This is my library, where I want to create a folder and upload the files selected in the previous page.

I am trying to create a client request using SP.ClientContext("/subs/spain/databackup/Data-Backup");

Can anyone please solve this query.

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,202 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,567 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,791 questions
{count} votes

2 additional answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 30,666 Reputation points Microsoft Vendor
    2022-05-19T02:44:50.337+00:00

    Hi @Gadhiya, Jenis ,
    Per my test, we can create a document library and copy the files selected to the library. But we are unable to copy the files to a subfolder of the library because of the SP.MoveCopyUtil.copyFile can only support copy files between library level. You can refer to following code
    203531-backupfile.txt


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



  2. Gadhiya, Jenis 21 Reputation points
    2022-05-24T14:04:52.347+00:00

    Hi @RaytheonXie_MSFT,

    I resolved the issue just today, Your code helped me a little bit, But I gathered code from 3 to 4 places and attached it together.
    Now the whole system is working.

    I tried uploading the code, but I am facing some error.
    Have a nice day,

    Thanks
    Jenis Gadhiya
    205181-upload-file-in-backup-folder.txt

    0 comments No comments