sharepoint - Rename the Uploaded Document in document library using the CSOM -
i uploaded document in sharepoint document library using csom. need rename uploaded file using csom, here code
web web = context.web; bool iscontinue = false; filecreationinformation newfile = new filecreationinformation(); newfile.content = system.io.file.readallbytes(inputfilename); newfile.url = "/" + newfile; list docs = web.lists.getbytitle(configurationmanager.appsettings["documentlibraryname"]); string strfilename = inputfilename; //rename list docs = web.lists.getbytitle("shared documents"); docs = web.lists.getbytitle(convert.tostring(configurationmanager.appsettings["documentlibraryname"])); microsoft.sharepoint.client.file uploadfile = docs.rootfolder.files.add(newfile); context.load(uploadfile); context.executequery(); listitem item = uploadfile.listitemallfields; string renamefile = txtfilename.text.tostring(); string doctitle = string.empty; item["title"] = renamefile; item.update(); renamefile(context, strfilename, renamefile);
Comments
Post a Comment