Thursday, November 22, 2007

Passing url parameters to webpart in SharePoint

Sometimes you may need to create a webpart page in SharePoint that it can use the parameters passed by url. But the "Page Viewer" webpart does not allow you to use the parameters in your webpart page url. I even tried to use SharePoint Designer 2007 to modify the page directly, but still does not work.

So I think why not directly use a "Content Editor" webpart? Because a content editor webpart allows you to embed javascript code in it. We can use an "iframe" which url is generated by javascript with url parameters from the webpart page.

Then I create a webpart page, insert in a content editor webpart, and then insert the following code in it:

<script type="text/javascript">
function getQueryStringRegExp(name)
var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " "));
return "";

document.write("<iframe src='"
+ getQueryStringRegExp('test') + "' width=100% height=100%></iframe>");

The function getQueryStringRegExp is for retrieve parameter value from url, which is get from here:

Monday, November 19, 2007

Installing Microsoft SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint Technologies Failure

As you know, if you want to show reports created by Microsoft SQL Server 2005 Reporting Services in a SharePoint website, you need to first download and install an add-in from Microsoft official website. However, this installation probably will fail. The symptom is you can't see the report server section as you expected. To solve this problem, you can do the following things as I did:

1. Check the Reporting Services installation log. This log is normally in the %temp% folder, but please notice, it's in an upper folder of %temp% because %temp% will direct you to a number named folder such as "1", its parent folder normally will be named as "temp", that's the folder I mentioned here.

2. In the folder I mentioned in step 1, there normally will have several files named as RS_SP_0.log or RS_SP_1.log, it depends on how many times you installed or uninstalled the add-in. Check the log file with the biggest number.

3. The first line of the log file is something like: User: SYSTEM. This specified the user used for installing this add-in. And in 7 or 8 lines below it, you could probably see a line saying "******* User does not have permission to add feature to site collection: http://yourwebsite:80". If so, this article will be useful for you.

4. Now you can open your SharePoint administrator UI, in "Application Management", choose "site collection administrators", change the web application to the one it mentioned above that has no permission, and add the user name in the first line of the log in. Then you can try to install again, check the log file again, there should have no permission error anymore, and you should be able to see the report section in your administrator UI.

That's it, hope this is useful for you!

Saturday, November 17, 2007

Cover Post

This blog is created for sharing some technical knowledges that I got during daily work, and hope these knowledges may useful to other people in internet.

I am an software engineer, and always an engineer for 10+ years, in next 10+ years, I hope I still could have some time to be an engieer. Solving problems already become part of my daily life, just hope not to take too much time.

I am a Chinese people live in China, and if someone in China has good English, they may reach my blog and study some knowledge, but if they can't understand English, I am sorry, as I can write, you should can understand.

This post will be the first one and the last one in this blog talking something outside of techniche. It's also for test purpose.