javascript - SharePoint List Button that browses for files and folders, then puts path and file names in SharePoint List Column WITHOUT using ActiveX -
i trying create button using sharepoint designer onclick allow users browse folders , put contents (path:\filenames
) sharepoint list column. have used below code , works except need solution not use activex system set not allow unsigned activex. open solution work on sharepoint list not use , activex control. button onclick="getfolderfiles()"
function getfolderfilessub(fsofolder, astrfolderfiles) { var efiles = new enumerator(fsofolder.files); efiles.movefirst(); while (efiles.atend() ==false) { astrfolderfiles.push(efiles.item().path); efiles.move.next(); } var esubfolders = new enumerator(fsofolder.subfolders); esubfolders.movefirst(); while (esubfolders.atend() == false({ getfolderfilessub(esubfolders.item(), astrfolderfiles); esubfolders.movenext(); } } function getfolderfiles() { var objshell = new activexobject('shell.application'); var objshellfolder = objshell.browseforfolder(0, 'choose folder', 0, 0); if (objeshellfolder != null) { var fso = new activexobject('scripting.filesystemobject'); var fsofolder = fso.getfolder(objshellfolder.items().item().path); astrfolderfiles = new array(); getfolderfilessub(fsofolder, astrfolderfiles); if (astrfolderfiles.length != 0) { var strfolderfiles = astrfolderfiles[0]; (var i=1; <= astrfolderfiles.length-1; i++) { strfolderfiles = (strfolderfiles + '\n\ + astrfolderfiles[i]; } document.getelementbyid(ct100$placeholdermain$g_85cf34cd_8dc3_47ca_85d9_ a6f47297db56$fffilenames$ct100#ct100$text field").value = strfolderfiles; } }
Comments
Post a Comment