question

GadhiyaJenis-6620 avatar image
0 Votes"
GadhiyaJenis-6620 asked GadhiyaJenis-6620 commented

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

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.

office-sharepoint-server-administrationoffice-sharepoint-server-developmentoffice-sharepoint-server-customization
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @GadhiyaJenis-6620 ,
I am currently doing some research on this issue, will let you know as soon as possible

0 Votes 0 ·

Thank you for taking some time.

0 Votes 0 ·

Hello,

The problem is now solved and the code is in the below attached file.

Thank you
Jenis Gadhiya

[205089-upload-file-in-backup-folder.txt][1]
[1]: /answers/storage/attachments/205089-upload-file-in-backup-folder.txt

0 Votes 0 ·
sadomovalex avatar image
0 Votes"
sadomovalex answered

it is possible to access data in another site collection via javascript object model. Try to use full (absolute) url of another site when create SP.ClientContext. See example e.g. here: Can we access list from other site collection sites using javascript object model.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered RaytheonXie-MSFT commented

Hi @GadhiyaJenis-6620 ,
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.





backupfile.txt (2.8 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @GadhiyaJenis-6620 ,
Have you tried the solution I proposed?

If you have any questions or progress, you can contact me in time.

Looking forward to your reply

Have a lucky day!

Thanks,
Raytheon Xie

0 Votes 0 ·

Hi @GadhiyaJenis-6620 ,
Would you tell me whether your issue has been resolved or have any update?
I am looking forward to your reply.

Have a nice day!

Thanks,
Raytheon Xie

0 Votes 0 ·
GadhiyaJenis-6620 avatar image
0 Votes"
GadhiyaJenis-6620 answered

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



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.