Java
Programatically add file in folder in sharepoint Document Library
SPSite site = SPContext.Current.Site;
SPWeb oweb = site.OpenWeb();
oweb.AllowUnsafeUpdates = true;
SPList olist = oweb.Lists[listid];
SPListItem oitem = olist.GetItemById(Convert.ToInt32(itemid));
SPList list = oweb.Lists["SharedDocuments"];
SPFolder folder = list.RootFolder.SubFolders["Folder1"];
byte[] file = oitem.File.OpenBinary();
string dsturl = list.RootFolder.SubFolders["Folder1"].Url + "/" + oitem.File.Name;
SPFile myfile = folder.Files.Add(dsturl, file, true);
list.Update();
smaran manjulaPosted Apr 12, 2017, 7:12 AM
This is not working
Guest UserPosted Apr 7, 2017, 3:10 AM
Can it be implemented across SharePoint Online also? Please provide the complete code and total process of how to achieve it for O365 and should we pass our credentials too for this process? Please provide me the details in depth kindly.