Search code examples
javascriptdynamics-crm-4

Open Folder on IE using javascript (CRM 4.0)?


I want to see my specific folder on IE window.i use window.open(); and then i get an error "Access denied".I gave "everyone" permission on this folder and share it.

var oShell = new ActiveXObject("Scripting.FileSystemObject");
var Path="C:\\test\\"+crmForm.ObjectId;
  if (! oShell.FolderExists(Path) )
{
  oShell.CreateFolder(Path)
}    

crmForm.all.new_paylasim.DataValue=Path;
var urlField =crmForm.all.new_paylasim;

urlField.style.color = 0x0000ff;

urlField.style.textDecorationUnderline = true;

urlField.style.cursor = "hand";

urlField.ondblclick = function() {

var url = urlField.DataValue; // Or get it from somewhere else

if (url != null && url.length > 0) {
window.open(url);

}
}

What's solution?


Solution

  • You have to problems

    1. the security model of IE has changed and window.open with a local file path does IMHO not work anymore. See also Ie 8.0 Access Denied When Trying To Open Local Files
    2. Your file uri is not correct. It should be either file:///C:/myfile.txt (which doesn't work anymore) or file://server/share for a network share. See http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx

    Create a network share for the folder you would like to open.