Don't mess with sharepoint...
Carefully said I do not like that sharepoint “hijacks” the Internet Information Server. When you create a virtual directory it is just not accessable because SharePoint took over IIS.
Funny fact: This is the second post how to fix issues with IIS and “extension” that cause issues :-)
So I decided to hack a small utility serving my needs…
- Enable to exclude applications from sharepoint services through the directory context menu.
Because I’m running my machine under a LUA (Limited User Account) I wrote the tool in a way that you can install and uninstall it without administative rights - the contextmenu will be installed per user!
if(args[0] == "-install"){
RegistryKey rkey = Registry.CurrentUser;
rkey = rkey.OpenSubKey("SOFTWARE\\Classes",true);
rkey = rkey.CreateSubKey("Folder").CreateSubKey("shell");
rkey = rkey.CreateSubKey("Exclude from Sharepoint");
rkey = rkey.CreateSubKey("command");
rkey.SetValue(null, App.Application.ExecutablePath + " \"%1\"");
} else if(args[0] == "-uninstall"){
RegistryKey rkey = Registry.CurrentUser;
rkey = rkey.OpenSubKey("SOFTWARE\\Classes\\Folder\\shell",true);
rkey.DeleteSubKeyTree("Exclude from Sharepoint");
} else {
...
}
The Implementation works with the webserver extensions version 4.0 or higher
RegistryKey rkey = Registry.LocalMachine;
rkey =
rkey.OpenSubKey(
"SOFTWARE\\Microsoft\\Shared Tools\\Web Server Extensions",
true);
foreach(string subKeyName in rkey.GetSubKeyNames()){
try {
int.Parse(subKeyName.Replace(".",""));
RegistryKey fpKey = rkey.OpenSubKey(subKeyName,true);
fpDir = (string)fpKey.GetValue("Location");
...
} catch(Exception _ex) {
string _err = _ex.ToString();
...
break;
}
}
and uses the stsadm.exe from the shared tools of the server extensions.
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = Path.Combine(fpDir, "BIN\\stsadm.exe");
p.StartInfo.Arguments = "-o addpath -url http://localhost/" +
strProjectName + " -type exclusion";
...
p.Start();