Rename a file in Document Set Folder in remote server
hi all,
i need quite urgent you. have uploaded files in document set. files present in below path
http://server-name/sites/sitename/doc-lib-name/doc-set-name/file1.docx similarly file2.docx, file3.docx etc.,
some of file extension wrongly uploaded "file4.docx-01". here "-01" wrongly appended file extension. need remove using client object model. im able retrieve folder(doc-set-name) if try reupload file, gives error system.io access error . below code im using.. please me rename file.
in advance..
code:
foreach (microsoft.sharepoint.client.file f in defaultdocumentfiles)
{
litem = f.listitemallfields;
fci = new filecreationinformation();
using (system.io.filestream fs = new system.io.filestream("https://server.com/sites/sitename/style%20library/publishnewinfotemplate/template.txt", system.io.filemode.open))
{
byte[] imagedata = new byte[fs.length];
fs.read(imagedata, 0, system.convert.toint32(fs.length));
fs.close();
fci.content = imagedata;
fci.url = "https://server.com/sites/sitename/doc lib/" + "doc set name" + "/" + f.name + ".aspx";
}
defaultdocumentfile = defaultdocumentfiles.add(fci);
context.load(defaultdocumentfile);
listitem item = defaultdocumentfile.listitemallfields;
context.load(item);
fieldurlvalue itemdocurl = new fieldurlvalue();
itemdocurl.description = "link document";
itemdocurl.url = litem["url"].tostring(); ;
item["url"] = itemdocurl;
i told can in first post. need on server side code. or if need quick fix, go server rename files.
how can not have access server? if app hosted, should able contact hosting service have them it.
if upload code made mistake, don't want change upload service code fix it?
Silverlight > Programming Silverlight with .NET – General
Comments
Post a Comment