Showing posts with label Query String. Show all posts
Showing posts with label Query String. Show all posts

Tuesday, November 17, 2009

RootFolder Query string bug

Scenario:
Funny, still finding weird bugs in SP2007.

I had a navigation web part and had a link to add a new item inside a sub folder within a list.

When I click on link I can add new items but when I hit OK to save it, I gets Access Denied.

But if same account directly navigate to the folder with in that list, he can add a new item without any issue. hmmm...

Solution:
I copied both the Urls ( New item page link ) and started comparing.

Sample:

Working : http://localhost/Lists/Custom/NewForm.aspx?RootFolder=/ABC

Not working : http://localhost/Lists/Custom/NewForm.aspx?RootFolder=/abc
Lesson learnt:
Urls are not case sensitive but Query parameters are ( specially if they are not handled for ignoring case )

Changing the abc to ABC solved the issue.

Tuesday, August 18, 2009

Updating Query String values

Scenario:
I have done it many time with different ways, hopefully this is easiest way and i am blogging it , I can stick to it for time longer without rediscovering the wheel again :-)

Solution:
Using NameValueCollection object.

Code:

using System.Collections.Specialized;

NameValueCollection variables = new NameValueCollection(this.Page.Request.QueryString);

string queryParameter1 = "ID";
if (!string.IsNullOrEmpty(variables[queryParameter1]))
variables.Remove(queryParameter1);

variables.Add(queryParameter1, fieldName);

string queryString = string.Empty;
foreach (String s in variables)
{
queryString += s + "=" + variables[s] + "&";
}

string newUrl = string.Format("{0}?{1}",this.Page.Request.Path,queryString)

Monday, December 8, 2008

Search Url query string parameters

Search Query string parameters:
Search Center Url supports various query string parameters.

Here's the description :

K= Search key

http://localhost/search/results.aspx?k=sharepoint
This url searches for keyword sharepoint

v1= Order By
http://localhost/search/results.aspx?k=sharepoint&v1=date
This url searches for keyword sharepoint and orders the search results by modified date

s= Search Scope
http://localhost/search/results.aspx?k=sharepoint&s=All%20Sites
This url searches for keyword sharepoint in all sites scope

start1= Page start
http://servername/search/results.aspx?k=sharepoint&start1=15
This url searches for keyword sharepoint and returns results from 15th record