At first, I did not include the RootFolder parameter in the URL. If the
user clicked on a link to a sub-folder, SharePoint automatically APPENDED a
URL parameter for "RootFolder". And when it does, it includes the "http://"
and portal name. Like this:
When the user clicks on "New Document", then names the basic web page, then
clicks on the "Create" button, user gets the following error (from
owssvr.dll):
"Invalid URL Parameter
The URL provided contains an invalid Command or Value. Please check the URL
again."
If I change the initial web part code to INCLUDE a "RootFolder" parameter
that is the URL Path of the listItem (which does NOT include http:// and
portal), then this error is fixed. However, the AllItems.aspx STILL appends
a "RootFolder" parameter, so now there are two of them, like this:
and the folder display on AllItems.aspx now shows both the name of the
folder and the entire URL of the folder, in other words, it displays both
parameters, and to the user its a bunch of junk that doesn't need to be there.
This is really weird and I have no clue what is going on. Has anyone else
run into this?
Here's a snippet of psuedo code, just at the point at which I am creating
the URL:
string PT = listItem.ParentList.BaseTemplate.ToString();
switch(PT)
{
case "DocumentLibrary":
string rootURL = listItem["URL Path"].ToString();
whatToOutput = "<A HREF='" + rootURL + "?RootFolder=" +
SPEncode.UrlEncode(rootURL) + "'>" + listItem["FileLeafRef"] + "</A>";
break;
}
output.Write(whatToOutput);
As far as I can tell, the only difference between the url my custom
part generates and Sharepoint's url is that the custom url has the
"http://domain" path appended to the rootfolder parameter.
I've tried using the Url property of the SPFolder object, but the
result has been the same.
Has anyone else encountered this problem?
string url = string.Format("{0}?RootFolder={1}",
parentList.DefaultViewUrl,
SPEncode.UrlEncode(folder.ServerRelativeUrl));
Where parentList is the SPList object that contains the the folder.
It feels like a hack, but it works.