in SharePoint 2007

Using query parameters in SharePoint page layouts

I had a strange case today where SharePoint was throwing this error

No item exists at http://mytestsite?id=4.  It may have been deleted or renamed by another user.

I use pagination in one of my page layouts and I got the above error when I select a page in the preview display mode when I check in draft. There was nothing wrong in the code that I could change as things seem to work fine if I publish the page.

Googling, I found this thread at the MSDN forums

Never put the same name to your parameters what sharepoint is using as internal or display name.
Give your own name then you never get this problem.

like:- Instead of  http://server/Pages/Publish.aspx?publishFileName=folderName/subfolderName/filename&ID=12

use this  http://server/Pages/Publish.aspx?publishFileName=folderName/subfolderName/filename&PublishItemID=12

Yep, things worked fine for me after changing my query parameter ‘id’ to something else, like ‘pageid’

http://mytestsite?id=4 to http://mytestsite?pageid=4

Its very bad that SharePoint internally uses the query parameter “id” for its internal use. I am sure many developers would choose ‘id’ as the query parameter for anything they start with. I mean, something like “spid” or “sharepointId” would have been fine, right?

 P.S – http://mytestsite is some randomly chosen name

Write a Comment