Mar31

Parameterised SQL Reports in SharePoint

 Categories: Deployment, Reporting Services, SharePoint

So, I've developed a parameterised report and surfaced it inside a SharePoint site using the Report Viewer Web Part.
 
Now the user has this 'nice' pane on the side of the report to supply the parameter value....

Supply Parameter Pane.

 
How do I provide parameter values without requiring user intervention? Just follow these easy steps.
 
 
Put the page hosting my web part into edit mode:

Edit Page

 
Next click on the edit button for the Report Viewer Web Part, we see the connect to option, but it's disabled. :o(

Edit Web Part with no available connections.

 
A connectable web part to provide the parameter(s) is needed...
Click on one of the Add a Web Part headers.

Add A Web Part

 
Luckily OOTB there are a bunch of Filter Web Parts which we can use for just this purpose! I chose to use the Query String (URL) Filter. 

Add a Web Part Screen.

 
Now open the tool pane.

Open Tool Pane

 
Configure the filter web part.

Tool Pane Configuration

 
The web part is now configured but not connected.

Configured Web Part

 
Now you need to connect the web parts, note that you can choose to connect the web parts from either end.

Connect from filter end

OR

Connect from report viewer end

 
The connection between the web parts needs to be configured.

Configure the connection

 
Now the screen looks like this:

Parameters have not been supplied

 
Once the courseCode query string parameter is supplied the report will be generated using that parameter value.

Parameters have been supplied.

 
 
I hope this helps some one else out there.
 
 
 
Mar31

Developing SQL Reports: Useful Resources

 Categories: Development, Intergen, Reporting Services, SharePoint

OK, so I promised more on the reporting services front. This post is just a quick follow up on that with a few resources, a.k.a blog posts from smart cookies, that I found VERY useful.
 
A great 3 part intro on how to build your reports using the Report Designer in Visual Studio: http://www.simple-talk.com/sql/learn-sql-server/beginning-sql-server-2005-reporting-services-part-1/
 
Tips on formatting from fellow Intergenite, Jo: http://notethat.blogspot.com/2007/10/reporting-services-tips-tricks-and.html.
 
 
 
 
Mar26

Installing SSRS in SharePoint Integrated Mode

 Categories: Deployment, SharePoint, Reporting Services

Oops, nearly two weeks since a post! That's a bit of an indicator of how busy I've been of late...
 
Anyway, I had to set up up SQL Server Reporting Services in SharePoint Integrated mode.
 
Not too difficult on the whole, I'd done it before and found it pretty painless. Just follow the "Configuring Reporting Services for SharePoint 3.0 Integration" article on MSDN and it all just works... last time....
 
This time I found a few issues, firstly I couldn't actually access the report server virtual directory by browsing to the url I'd set up for my reporting site using IWA. I was getting a "HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials" message:o| Luckily I found a great KB article that gave me a workaround.
 
So next it was on to installing the SharePoint addin and configuring it, no troubles, until I was up to the last step of configuring Reporting Services inside SharePoint where upon I recieved a "An unexpected error occurred while connecting to the report server. Verify that the report server is available and configured for SharePoint integrated mode. --> The request failed with HTTP status 502: Proxy Error ( Internet Control Message Protocol (ICMP) network is unreachable. For more information about this event, see ISA Server Help.  )." error message :o(
 
WTF?? I'm working in a VM environment where ISA is not present, checking my "Internet Options" shows that I'm just using the LAN connection, not using a proxy server and not auto-detecting. Where on earth is this proxy error and mention of ISA coming from?
 
After some log trawling and interpreting it turns out that SharePoint has a config setting that allows it to auto-detect any proxy-servers...
 
<system.net>
    <
defaultProxy>
        <
proxy autoDetect="true" />
    </
defaultProxy>
</
system.net>
 
So what was happening was my VM hosted SharePoint instance was detecing our corporate proxy server then trying to route requestes for the reporting server throught said proxy server which had no idea where my reporting site URL was supposed resolve to.
 
Toggling the autoDetect element to false solved my issues. I had to repeat this step for the site that was being used surface the reports via the Report Viewer web part.
 
-Gavin
 
p.s more posts on the reporting services front to follow ;o)
 
 
Mar13

Need to resize a VHD?

 Categories: General, Tools

I do most of my development using virtual machines now and according to all the information that I've seen fixed sized disks perform better, this great until like me you start to run out of space on the VM you're using....
 
So in my hunt to find a good utility to re-size my vhd I stumbled across a tool called VHD Resizer. It's very easy to use and creates a copy of your original VHD in a new VHD file of a size that you choose :o)
 
VHD Resizer Interface
 
Download the tool here, download requires registration.
 
Edit: Oh yeah, you'll need to use a tool like Partition Manager to allocate that space into your VHD afterwards.
 
 
Mar12

VSeWSS 1.0 and solution.xml

 Categories: Development, VSeWSS, Visual Studio

So, I have a project that I'm still working on that is using VSeWSS 1.0 project templates.
 
I just got bitten by an issue I knew about from prior experience :o\
 
With this version VSeWSS creates a file called solution.xml in the root project folder, this appears to be used as offline storage for the settings for the Visual Studio Project that are edited through the SharePoint Solution tab in the Project Properties page i.e. it's written to when you close the Visual Studio Solution. Cool, that seems to be a reasonable and valid approach.
 
The problem arrises when you put it under source control..... Now the file on disk is marked as read only. Now when you're closing the Visual Studio Solution the file that Visual Studio is trying to write to a read only file and can't, so the settings changes that you made are lost :o(
 
The work around? Simple, include the solution.xml file in the Visual Studio Project, check it out before you close the Visual Studio Solution using File > Close Solution, then check in the solution.xml file to share your changes with the rest of the team and you're golden! :o)
 
 
 
Mar12

VSeWSS Deployment Issue

 Categories: Deployment, VSeWSS, SharePoint, Development

Ok, here at Intergen we are working on the VSeWSS 1.1 User Guide. As part of this we have to create code samples in both C# and VB.NET for all the code that we produce. No big deal really.
 
Except that when you attempt to deploy the second version of the code you get the message:
"This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name."
Huh? What's going on here was my first reaction. After applying a little thought to it I realised that there was a solution package added and deployed to the SharePoint server that had same name as the one I was attempting to deploy. This solution package also contained assemblies of the exact same names as those that I was trying to deploy this time, in my case the C# version had been done first.
 
So knowing a little of what happens at pacaking and deployment time I opened up a file browser and looked in the bin\debug folder of the current project. Had the packaging worked I would have found a .wsp file and a setut.bat file, neither of these was presesnt so the check that throws up this message must be run prior to packaging the .wsp file for our VB.NET version.
Luckily I had the setup.bat file from the C# version! So I just ran setup.bat /uniinstall which will remove the solution package for which it was generated.
 
However, should you not have that file, it's still pretty easy to get arround this problem, it just requires a little stsadm fu!
Open up cmd and run these commands:
 
C:
cd "\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
stsadm -o enumsolutions
 
Now examine the XML output to see if you have a .wsp in that list that matches the name of the .wsp that will be created and deployed by VSeWSS for the project that you're working on. If you do you're in business!
 
stsadm -o retractsolution -name <Solution name> -url <virtual server url> -local
stsadm -o deletesolution -name <Solution name>
 
Note: do this with care! If the solution you remove is not on that you've developed then you might break other features in your SharePoint instance.
 
 
Mar9

SPQuery is not reusable.

 Categories: SharePoint, Development

So I'm writing some code to assemble some information about items in a list.
 
My original approach was this:
SPQuery query = new SPQuery();
query.Query = GenerateLodgedSubmissionsQuery(studentId, activityId);
SPListItemCollection submittedItems = submissionsList.GetItems(query);
response.SubmittedFiles = CreateFileDetailsList(submittedItems, false);
if (0 < submittedItems.Count)
{
    response.ActivityName = submittedItems[0]["ActivityName"].ToString();
    response.ActivityId = submittedItems[0]["ActivityId"].ToString();
}
query.Query = GenerateReturnedSubmissionsQuery(studentId, activityId);
SPListItemCollection returnedItems = submissionsList.GetItems(query);
 
The problem here was that the second call to GetListItems was returning the exact same results as the first call, despite having changed the Query property of the SPQuery object.
 
After much second guessing of my CAML query generation code and ensuring that the SPQuery.Query had infact changed I tried making the second GetListItems call with a new SPQuery object:
SPQuery query = new SPQuery();
query.Query = GenerateLodgedSubmissionsQuery(studentId, activityId);
SPListItemCollection submittedItems = submissionsList.GetItems(query);
response.SubmittedFiles = CreateFileDetailsList(submittedItems, false);
if (0 < submittedItems.Count)
{
    response.ActivityName = submittedItems[0]["ActivityName"].ToString();
    response.ActivityId = submittedItems[0]["ActivityId"].ToString();
}
SPQuery returnedItemsQuery = new SPQuery(); 
returnedItemsQuery.Query = GenerateReturnedSubmissionsQuery(studentId, activityId);
SPListItemCollection returnedItems = submissionsList.GetItems(returnedItemsQuery);
 
Now I finally saw the results that I was looking for.
 
 
Mar7

Intergenite delivers in browser viewer for docx

 Categories: OpenXML, General, Intergen

Here at Intergen I have the good fortune of working with lots of very tallented people. 
 
One of them, James Newton-King, has developed a means of viewing Microsoft Word 2007 documents in a web browser, on any platform!
 
His solution, called TextGlow capitalises on the OOXML format used for docx files and is built using Silverlight 2.0. For more info read James' post: http://james.newtonking.com/archive/2008/03/06/silverlight-2-0-ooxml-textglow.aspx
 
 
Mar7

Comments are now working....

 Categories: General

Ooops.
 
After telling Brendan to fix his comments I discovered that mine were not working either as CAPTCHA was broken.
 
So I've removed that for the moment. Please feel free to comment :o)
 
 
Mar6

Deploying Timer Jobs

 Categories: Deployment, SharePoint

So I'm working on a Timer Job for SharePoint at the moment, I found that the post that Andrew Connell has made describing the development proces is very good, read it here: http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx
 
Anyway I was trying to debug my job by attaching to the OWSTIMER process and it appeared that the process was running an old version of my code. :o\ It appears that to ensure that the newly deployed version of the DLL that you have deployed to the GAC you need to restart the OWSTIMER process.
 
So  I've included that into my script to deploy and everything is happy again. Below is a sample deployment script for your reference.
 
net stop sptimerv3

rd /s /q "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\MyTimerJob"
mkdir "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\MyTimerJob"

copy /Y feature.xml "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\MyTimerJob\"

gacutil /u MyTimerJob
gacutil /i bin\debug\MyTimerJob.dll

pushd %programfiles%\common files\microsoft shared\web server extensions\12\bin

stsadm -o deactivatefeature -filename MyTimerJob\feature.xml -url http://col/ -force
stsadm -o uninstallfeature -filename MyTimerJob\feature.xml -force
stsadm -o installfeature -filename MyTimerJob\feature.xml -force
stsadm -o activatefeature -filename MyTimerJob\feature.xml -url http://col/ -force

popd

net start sptimerv3
 
 
 Next >>