Microsoft SharePoint Team BlogThe official blog of the Microsoft SharePoint Product Group
How We Did It – Automating Service Requests using InfoPath Forms Services
Overview
Today's guest blog post is from ThreeWill, a Microsoft Managed Gold Partner located in Alpharetta, Georgia that focuses on SharePoint development and integration. ThreeWill recently worked with Microsoft to build a generic Service Request Office Business Application (OBA) using InfoPath Forms Services. The application addresses the need for enterprises to have a no-code way to quickly turn around service request based SharePoint sites (i.e. sites that are using electronic forms to initiate a request and tie that request to a workflow).
Some Service Request examples are:
- Request for Marketing Funds
- Request for Laptops or other equipment
- Request for Project Site Creation
The solution is packaged up as a SharePoint Feature to enable deployment to a Server Farm and standard SharePoint provisioning. The application supports integration with Active Directory to pre-populate user information and provides easy access to Web Services from InfoPath using Data Connections. Finally, configuration information is stored in a SharePoint List for secure yet convenient access to Site Administrators. Over to ThreeWill on how they did it.
Pej Javaheri, SharePoint Product Manager.
In Figure 1 you see the home page for the site. As you can see from in the Quick Launch navigation, users can create, edit, and view requests. This enables self service applications that can be easily configured for a multitude of purposes.
Figure 1 – Home Page for the Service Request Application
Core Usability Features
One of the main goals for the project was to make some key changes to standard InfoPath Forms behavior to improve the user’s experience. For example, when you go to create a request from the “Create Request” link in the Quick Launch navigation, it brings you to the “Create/Edit Request” page with the InfoPath Form embedded as a Web Part Page. When the user saves the request, it is saved with an auto-generated name and the user is brought back to the Home page of the Service Request site. These “tweaks” to the interaction with the Form improved the overall user experience of the site.
To implement these features, the team wrapped an instance of the XML Form Viewer in a Web Part.
To apply the standard naming convention we overrode the SubmitToHost event to save the form with a naming convention based on the user name and the current time.
void _xmlFormViewControl_SubmitToHost(object sender, SubmitToHostEventArgs e)
{
const string formLibraryName = "Requests";
SPWeb currentWeb = SPContext.Current.Web;
// Get the contents of the form and put them into a byte array
XPathNavigator nav = _xmlFormViewControl.XmlForm.MainDataSource.CreateNavigator();
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] contents = enc.GetBytes(nav.OuterXml);
//load in the xml document so we can extract out fields by name
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(nav.OuterXml);
Dictionary<string, ArrayList> documentFields = Utility.GetNameValuePairs(xmlDocument);
//retrieve InfoPath form keys from the Configuration list
Dictionary<string, string> configuration = Utility.GetConfiguration(SPContext.Current.Web);
string [] formKeyFields = string.IsNullOrEmpty (configuration[Utility.ConstInfoPathFormKeysParameterColumn])?
new string [0]:
configuration[Utility.ConstInfoPathFormKeysParameterColumn].Split(',');
//begin to build the filename
string filename = "";
//iterate through each form key field
foreach (string formKeyField in formKeyFields)
{
//if the form key field is found in the InfoPath form, add it to the filename
if (documentFields.ContainsKey(formKeyField.Trim().ToUpper()))
{
foreach (string fieldValue in documentFields[formKeyField.Trim().ToUpper()])
{
filename += fieldValue;
filename += "_";
}
}
}
//name files using the user name and date if the infopath form keys could not be found
if (string.IsNullOrEmpty(filename))
{
filename = SPEncode.UrlEncode(currentWeb.CurrentUser.Name.Replace('\\', '-')) + "_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".xml";
}
else
{
//trim any training underscores, add the file extension
filename = SPEncode.UrlEncode(filename.Trim(new char[] { '_' })) + ".xml";
}
// Determine the URL of the new file
string saveUrl = currentWeb.Url + "/" + formLibraryName + "/" + filename;
// open document library as a folder
SPFolder docLibFolder = currentWeb.GetFolder(formLibraryName);
// Save the form by adding its contents to the document library
if (string.IsNullOrEmpty (_xmlLocation) == false && docLibFolder.Files[_xmlLocation] != null)
docLibFolder.Files[_xmlLocation].SaveBinary(contents);
else
docLibFolder.Files.Add(saveUrl, contents);
}
The Close event is where we handled sending the user back to the home page.
void _xmlFormViewControl_Close(object sender, EventArgs e)
{
// Inspect the QueryString
if (this.Page.Request.QueryString["Source"] != null)
{
SPUtility.Redirect("", SPRedirectFlags.UseSource, this.Context);
}
else
{
SPUtility.Redirect(SPContext.Current.Web.Url + "/default.aspx", SPRedirectFlags.CheckUrl, this.Context);
}
}
Also, the “Edit My Request” link included some usability improvements. When a user clicks this link and they have only one request for the site, that request is loaded. If they have no requests, it is like creating a new request. And if they have multiple requests they are brought to the list of requests. A Service Request Redirector class was created to handle these cases.
public class ServiceRequestRedirector : LayoutsPageBase
{
private const string FORMS_LIST_NAME = "Requests";
private const string QUERY_DEF = "<Where><Or><Eq><FieldRef Name='Author'/><Value Type='User'>{0}</Value></Eq><Eq><FieldRef Name='Editor'/><Value Type='User'>{0}</Value></Eq></Or></Where>";
protected override void OnLoad(EventArgs e)
{
// get current site, web and user
SPSite siteCollection = this.Site;
SPWeb site = this.Web;
SPUser currentUser = site.CurrentUser;
//get list of fields to return "<Where><Or><Eq><FieldRef Name='Author'/><Value Type='User'>{0}</Value></Eq><Eq><FieldRef Name='Editor'/><Value Type='User'>{0}</Value></Eq></Or></Where>"
string viewFields = GetViewFields();
//build the query string for querying the Request list
//to retrieve any item created or modified by the current user
string requestQueryFields = string.Format(QUERY_DEF, currentUser.Name);
string redirectUrl = default(string);
try
{
SPListCollection lists = site.Lists;
SPList timesheetList = site.Lists[FORMS_LIST_NAME];
SPQuery requestQuery = new SPQuery();
requestQuery.ViewFields = viewFields;
requestQuery.Query = requestQueryFields;
SPListItemCollection listItems = timesheetList.GetItems(requestQuery);
if (listItems.Count == 0)
{
redirectUrl = site.Url + "/SitePages/norequests.aspx";
}
if (listItems.Count == 1)
{
string url = Request.RawUrl;
redirectUrl = site.Url + "/SitePages/editrequest.aspx?XmlLocation=" + site.Url + "/Requests/" + SPEncode.UrlEncode(listItems[0].Title) + "&Source=" + SPEncode.UrlEncode(site.Url + "/default.aspx");
}
if (listItems.Count > 1)
{
try
{
if (Request.QueryString["Title"].ToString() != "")
{
redirectUrl = site.Url + "/SitePages/editrequest.aspx?XmlLocation=" + site.Url + "/Requests/" + Request.QueryString["Title"] + "&Source=" + SPEncode.UrlEncode(site.Url + "/default.aspx");
}
}
catch (System.ArgumentOutOfRangeException)
{
//no Title in QueryString, just continue to display all items
redirectUrl = site.Url + "/Requests/Forms/MyItems.aspx";
}
catch (Exception ex)
{
//no Title in QueryString, just continue to display all items
redirectUrl = site.Url + "/Requests/Forms/MyItems.aspx";
}
}
}
catch (SPException spe)
{
System.Diagnostics.Debug.Print(spe.Message);
}
//redirect to the correct page for the number of requests
SPUtility.Redirect(redirectUrl, SPRedirectFlags.CheckUrl, HttpContext.Current);
}
Other Key Features Implemented
The solution also included the provisioning of reusable web services that are consumed through Data Connections in InfoPath and a SharePoint Designer Custom Action. Therefore, the Site Designer just needs to know how to use InfoPath to design some pretty sophisticated forms.
Some web service features are:
- Connection to AD to pre-populate user profile information into a form based on the logged in user
- Retrieve SharePoint Group (if available) - used to simulate “role-based” functionality in a browser-enabled form.
- Cascading Filtering of List based data – allowing users to consume list data that is related by master/child relationship (e.g. State drop down driving the automatic filtering of a City drop down)
SharePoint Custom Actions included a new custom action in SharePoint Designer (runtime approvers) that provides the SharePoint Approval workflow with the list of approvers at run-time.
Form is pre-populated with information from Active Directory
User can select item in drop down list and other fields are updated based on that selection
Form can show master/child relationships
Figure 2 - Create/Edit Service Request Example
We had some key lessons learned when simplifying these services. Kirk ran into a gotcha when accessing a web service with anonymous access and trying to work with the current user. We also learned more about registering a Windows SharePoint Services 3.0 Hosted Web Service on the project and Pete followed up with a blog post to address the problem. Also, because some SharePoint web service calls do not have well defined schema for input and output parameters and/or the input/output schema is not easily consumed by tools such as InfoPath, we created a simplified Web Service class.
private SPList GetList(SPWeb site, string listName)
{
// Get the list
SPList list = null;
try
{
list = site.Lists[listName];
}
catch (Exception ex)
{
throw new Exception(String.Format("List [{0}] does not exist within site [{1}].", listName, site.Url), ex);
}
return list;
}
private List<ListItem> ExecuteQuery(SPList list, SPQuery spQuery, string fields, bool unique)
{
// Run the query
SPListItemCollection items = null;
try
{
items = list.GetItems(spQuery);
}
catch (Exception ex)
{
throw new Exception("Unable to execute query.", ex);
}
// Turn the output into our format
List<ListItem> response = new List<ListItem>();
Dictionary<String, String> uniqueItems = new Dictionary<String, String>();
foreach (SPListItem item in items)
{
StringBuilder uniqueSb = new StringBuilder();
// Populate a response item
ListItem responseItem = new ListItem();
responseItem.ID = item.ID;
responseItem.Title = item.Title;
responseItem.Fields = new List<Field>();
// Populate the fields for the response
foreach (string field in fields.Split(','))
{
string fieldName = field.Trim();
if (!item.Fields.ContainsField(fieldName))
{
throw new Exception(String.Format("Field [{0}] does not exist within list [{1}].", fieldName, list.Title));
}
Field responseField = new Field();
responseField.Name = fieldName;
object fieldValue = item[fieldName];
responseField.Value = (fieldValue != null ? fieldValue.ToString() : String.Empty);
responseItem.Fields.Add(responseField);
// Keep track of a unique key if we care about uniqueness
if (unique)
{
uniqueSb.Append(responseField.Value).Append('\0');
}
}
// Include the list item in the responses
// But don't include it if the user requested unique values and this item is not unique
if (!unique)
{
response.Add(responseItem);
}
else
{
string uniqueKey = uniqueSb.ToString();
if (!uniqueItems.ContainsKey(uniqueKey))
{
response.Add(responseItem);
uniqueItems.Add(uniqueKey, null);
}
}
}
return response;
}
List Based Configuration
To simplify administration of the sites the configuration is stored in a SharePoint list that is only accessible to the Site Administrator. The configuration parameters are stored as name/value pairs and allow the Site Administrator convenient access to configuration data through the familiar SharePoint interface.
Figure 3 - Configuration of Service Request Application
Summary
The benefit of this solution is an enterprise class Services Request application that requires no coding and can be configured for a number of purposes. The application has a number of key usability enhancements like auto generating form names and simplifying the process of working with forms. You can easily build the forms for the application using InfoPath and there are a number of key services that you can use like pre-populating information from Active Directory or building forms based on SharePoint list data. Configuration information for the application is stored in a SharePoint list to make it easy and secure to access.
Project Team Members
The team members who worked on this project included Pete Skelly, Eric Bowden, Kirk Liemohn, Chris Edwards, and Jerry Rasmussen. We would also like to thank Donna Hodges of Microsoft for her innovative enthusiasm to drive the concepts behind this project to reality. Finally, we want to thank Kern Sutton from Microsoft who was the business liaison that helped refine the business requirements and ensured that the necessary resources from the client and Microsoft were provided to effectively solve the business problem.
About the Authors
Pete Skelly – Pete is a Senior Consultant with ThreeWill. Pete is certified as a MCSD using Microsoft .NET, a MCTS: SharePoint Services 3.0, Application Development and is a Certified Scrum Master. Pete would prefer to play golf for a living, but playing with his two sons and paying bills always seem to get in the way.
Eric Bowden – Eric is a Senior Consultant with ThreeWill and enjoys recreational running (yes, there is such a thing), camping, outdoors with family, and optimizing commute times. Eric is certified as an MCSD as well but don’t let that fool you, he’s actually a strong coder with mad SharePoint developer skills.
Danny Ryan - Danny is a co-founder of ThreeWill and enjoys chasing his two little girls around the house when he is not talking to enterprises about how SharePoint slices bread. Danny writes a monthly newsletter, called SharePoint for the Enterprise, which covers key topics about successfully building “enterprise class” SharePoint applications – http://www.threewill.com/newsletter/ .
mehr...Announcing SPDisposeCheck tool for SharePoint DevelopersThe SPSite and SPWeb Dispose() methods are an important thing for developers who work with Microsoft SharePoint Products and Technologies to master. Many SharePoint API's allocate COM based memory that is not released by CLR garbage collection and must be released by calling the Dispose() methods. Microsoft Guidance for when to call SPSite and SPWeb Dispose() methods have been published in this MSDN whitepaper by Mike Ammerlaan and Scott Harris. In addition, Roger Lamb has provided additional detail and discussion on his MSDN SharePoint Developer blog. This guidance applies only to customers building custom software that they compiled to .NET assemblies that make use of SharePoint API calls. Also, an update to the MSDN whitepaper is being planned to reflect key guidance from the blogs.
Microsoft wants to help developers build better quality code that manages available memory better. We are now building a console tool that will help to evaluate customer code against the guidance that is provided. The tool, called SPDisposeCheck, will open your custom compiled assemblies recursively and validate them against the Microsoft published guidance. The output from the tool will contain messages that may indicate the SPSite and SPWeb Dispose() methods guidance are not being followed in the customers source code. While these messages need expert evaluation in order to determine if the software is not performing properly, in some cases just running the tool on your custom code can lead you to simple fixes that improve the quality and performance of custom code on SharePoint. This tool is planned for release during the coming North American Winter. Customers who are currently experiencing difficulties with memory management in their custom applications should review the guidance listed above. Customers who are currently experiencing difficulties with Microsoft Office SharePoint Server 2007 should contact their regular Microsoft Customer Support Services contact, or refer to http://support.microsoft.com.
References:
Best Practices: Using Disposable Windows SharePoint Services Objects
Best Practices: Common Coding Issues When Using the SharePoint Object Model
Roger Lamb's SharePoint Developer Blog
mehr...Microsoft User Research Group Looking for SharePoint UsersLast week, the Microsoft User Research team reached out to me regarding a set of studies they were planning to execute in the upcoming months. In a nutshell, the team focuses on how people interact with hardware and software products; and then the information and feedback gathered is translated directly into product improvements. For their next series of studies, they are looking for individuals who use SharePoint at least once a week.
The studies will be held at the Microsoft campus in Redmond, WA so they are looking for participants in the Puget Sound area.
If you are interested please email itusable@microsoft.com with your contact information and insert SharePoint into the subject line.
mehr...Visual Studio 2010 Tools for SharePoint Announced at TechEd EMEA Developers 2008This week at TechEd EMEA in Barcelona, Jason Zander, the GM for Visual Studio, announced and demonstrated the Visual Studio 2010 tools for SharePoint. Here's a quick summary of what he showed:
-
Server Explorer for SharePoint viewing Lists and other artifacts in SharePoint directly inside of Visual Studio
-
Windows SharePoint Services Project (WSP file) Import to create a new solution
-
Added a new web part project item and showed the Visual web part designer which loads a user control as a web part for SharePoint
-
Showed adding an event receiver for SharePoint and using the wizard to choose the event receiver and to just create a source file with that event receiver.
-
Added an ASPX workflow initiation form to a workflow project and showed how this workflow initiation form has designer capability
-
Showed the packaging explorer and the packaging editor which lets you structure the SharePoint features and WSP file that is created
You can learn more on Channel9 and the Visual Studio 2010 homepage.
mehr...Introducing the Microsoft Certified Master and Certified Architect for SharePointLast week at IT Forum in Barcelona, we announced the Microsoft Certified Master (MCM) for Office SharePoint Server 2007 and the Microsoft Certified Architect (MCA) for Office SharePoint Server 2007.
The Master program is designed to be the top-tier technical certification for SharePoint Products and Technologies for years to come. The goal of the MCM is to provide a means for training, recognizing, and developing the top SharePoint technical experts in the world. Specifically, the MCM is intended for technical professionals whose primary responsibilities include designing, building, configuring, deploying, and supporting large, often complex, MOSS 2007 environments.
Building on the MCM, the MCA certification is designed for professionals who possess an additional skill set focused on the larger business strategies and technical architecture as a whole. This skill set includes the ability to communicate with business and technology leaders, to understand the customer’s current and long-term organizational and technical needs, and to design a solution to meet those needs. To receive the MCA for SharePoint, students must first graduate from the MCM for SharePoint program and will then have the option of sitting for a comprehensive Review Board interview conducted by Microsoft experts and MCA’s.
If you feel you have the skills and experience to excel in this program, and are interested in being one of the first SharePoint Masters and/or MCA’s, I’d encourage you to visit the the MCM homepage for additional detail and prerequisites for the program. We are accepting applications into the program here.
mehr...How We Did It – Allowing Connections to Multiple SSRS Servers with Report Viewer and Explorer Web PartsOverview
Today’s guest blog post is from ThreeWill, a Microsoft Managed Gold Partner located in Alpharetta, Georgia that focuses on SharePoint development and integration. You might remember them from a previous article about the SharePoint Connector for Confluence. They worked with Microsoft on a recent project to extend some of the features of SSRS Web Parts to meet the needs of the enterprise.
In this project, ThreeWill helped a large telecommunications organization address their concern of being bound to one SSRS Reporting Server with the web parts. This concern was primarily because they did not have the luxury of combining all reports into one scaled SSRS environment. Of course, like so many other projects, the client needed a solution today, not months from now… this article has the details behind what they did on a week by week basis. Over to ThreeWill.
Pej Javaheri, SharePoint Product Manager.
First, a little bit more background. The core requirements of the solution were to enable SSRS web parts in SharePoint Server 2007 to point to multiple SSRS environments, a capability available in SSRS web parts for SharePoint 2003, with parameterization capability with the filter framework in SharePoint Server 2007. In essence, combine the best qualities of SSRS web parts from 2003 with 2007, as well ensuring usability was easy for end-users with minimal or no training required. Here’s how we did it and our approach.
Week 1
Getting Started
The obvious starting point for the project was to evaluate existing SSRS Web Parts available from Microsoft. We took a look at the v2 and v3 SSRS Web Parts available for SharePoint. We had a technology spike to determine whether to extend or rewrite either version of the Web Parts. After discussing the options with the SQL Server Product Team, we decided to implement two new Web Parts that use a similar design pattern used by the v2 Web Parts. From that foundation, we added additional features like managing Reporting Parameters either through the Web Part Editor or through Web Part Connections. Below is a comparison of the existing SSRS Web Parts compared to what was custom built.
| Feature |
Version 2 SSRS Web Parts |
Version 3 SSRS Web Parts |
Custom SSRS Web Parts |
| Web Parts |
Report Viewer; Report Explorer |
Report Viewer |
Report Viewer; Report Explorer |
| Reporting Server Configuration |
Supports specifying Report Server in Report Explorer and Report Viewer via Web Part Properties |
Can only point to one Reporting Server (configured through Central Administration) |
Supports specifying Report Server in Report Explorer and Report Viewer via Web Part Properties. |
| IFilterValues Interface Support for MOSS Filter Web Parts |
No |
Yes |
Yes |
| Report Parameters Support via Web Part Properties |
No |
Yes |
Yes (no data type checking during user input) |
| Supports Passing Report URL through Web Part Connections |
Yes |
No |
Yes |
The objective of the project was to build the following Web Parts:
- Report Explorer (Top Web Part) - allows you to browse existing reports on a SSRS Server and eventually select a report that is passed to the Report Viewer
- Report Viewer (Bottom Web Part) - allows you to display a preconfigured report (or a report determined at runtime through Web Part Connections).
Requirements Baseline
Due to budget and timeline, we had to make a judgment of what was appropriate to reuse from the architecture of SSRS and the existing SSRS Web Parts. We found the architecture of the v2 Web Parts were the best place to start to allow for code reuse and connection to multiple servers. The v2 Web Parts leverage the use of IFrames to an ASPX page hosted on the SSRS Server. This allowed the end user’s security credentials to pass through from the browser to the Report Server vs. a double hop through custom code in the Web Part. This also saved time with not having to recreate the UI elements and behaviors needed for a Report Explorer and Viewer. We extended the v2 capabilities in the Report Viewer by giving support for report parameters through Web Part Properties. The properties for the parameters leveraged the Web Services interface of the Report Server to, at runtime, render labels and controls for each available parameter on the report. By the end of the first week we finalized the product backlog – see below table for a sampling the product backlog items for each of the Feature Groups.
| Product Backlog Item |
Feature Group |
| Ability for Report Viewer to receive Report Parameters through Web Part connections |
Report Viewer |
| Ability to type in Report Server URL and Report Path in the Web Part Properties |
Report Viewer |
| Ability to view reports through a Web Part that supports reports that exist on one or more SSRS Report Servers |
Report Viewer |
| Ability to discover and configure Report Parameters in the Web Part Properties |
Report Viewer |
| Modify the Report Viewer Web Part to display an informational message if the Report Parameters cannot be retrieved |
Report Viewer |
| Provide Web Part connections between Report Explorer and Report Viewer |
Report Explorer |
| Package Web Parts for Report Viewer and Report Explorer as a WSP |
Deployment |
Week 2-3
Implementing the Report Explorer Web Part
To start the second week, we hit the ground running on building the new Web Parts that included a new Report Viewer and Report Explorer. In the interest of time, we did our best to leverage patterns and assets used by the v2 and v3 SSRS Web Parts. Note that SSRS Server natively hosts an ASPX page that contains the Report Explorer UI that is found in the v2 SSRS Web Part and leveraged by the SSRS built-in Report Manager. The Custom Report Explorer Web Part uses an IFrame to host this ASPX page. There are two parameters that are used to configure the Web Part – the “Reporting Server URL” and the “Starting Path” (screen shot of the Web Part Properties can be seen below). Note that the UI of the Report Explorer Web Part renders a view much like Windows Explorer (as shown earlier in this post). The “Report Server URL” points to the location of the SSRS Reporting Server. The “Starting Path” describes where to start in the view in case you wish to start in a subfolder. For example, you can configure the Web Part to start in the “HR Reports” folder when configuring for a HR SharePoint Site.
Adding Web Part Connections
To make Web Parts more useful, you can develop a Web Part to accept connections from other Web Parts on the same page. By creating connectable Web Parts, you have the ability to create new and more meaningful ways to view data and interact with a Web Part Page. In the case of the Report Explorer and Report Viewer, we want to pass the id of the SSRS Report Viewer Web Part back to the Report Explorer Web Part. The SSRS Report Explorer uses this id to specify which Report Viewer Web Part instance should be the “target” when a report link in the Report Explorer Web Part is clicked. In the screen shot below, we are setting the Web Part connection on the Report Explorer Web Part to connect to the Report Viewer Web Part.
The IWebPartField, shown below, is one of several standard interfaces used to create connectable Web Parts. As the name implies, IWebPartField is intended to pass a “field” of data while IWebPartRow and IWebPartTable are meant to pass a row and table respectively. Connections are enabled through the use of ConnectionProvider and ConnectionConsumer attributes.
Report Explorer Implementation
[ConnectionProvider("Report Explorer")]
public IWebPartField GetConnectionInterface()
{
_isWebPartConnected = true;
return this;
}
Report Viewer Implementation
//Get the connection
[ConnectionConsumer("Report Viewer", "ReportViewer",AllowsMultipleConnections=false)]
public void SetConnectionInterface(IWebPartField fieldProvider)
{
CustomReportExplorer reportExplorer = fieldProvider as
CustomReportExplorer;
if (reportExplorer != null)
{
reportExplorer.ConsumerId = this.ID;
_isWebPartConnected = true;
}
}
To learn more about Web Part Connections, see documentation on the SPWebPartConnection Class.
Implementing the Report Viewer Web Part
Like the Report Explorer Web Part, the Report Viewer Web Part renders content provided by the SSRS server through use of an IFrame for the ASPX page. Key features implemented to manage the interaction with the ASPX page are: a) a connection to the Report Explorer Web Part to allow a report to be passed to the Report Viewer, b) support for MOSS Filter Web Parts to be able to pass in reporting parameters through Web Part Connections, and c) ability for report parameters to be specified in the Web Part properties.
The Report Viewer Web Part uses the GetReportParameters method of the ReportServices2005 Web Service to retrieve report parameters. The Report Parameters from this method call are used for two purposes.
1. The parameter prompt (i.e. Display Name) is used in the IFIlterValues Interface so that the connecting MOSS Filter Web Part can choose which report parameter is receiving data.
2. The parameter display name and default values are used to build the list of parameters in the Web Part editor.
Note that if parameters are not supplied to the Report Viewer Web Part the ASPX page provided by SSRS Server renders input boxes at the top of the report as seen below.
Our client required that the reporting parameters also be provided through the Web Part Properties Editor and through Web Part Connections. Below is a view of supporting the parameters through the Web Part Properties Editor. This required dynamically discovering and rendering the label and input controls for the report parameters.
From a programmatic standpoint, the first step is to retrieve and store the report parameters so that we can use these for Web Part Connections and Web Part Properties. A CustomReportParameter class is used to store report parameter name/value pairs that are retrieved by an SSRS Web Services call.
ReportingService2005 svc = new ReportingService2005();
parameters = svc.GetReportParameters(ReportPath, historyID, forRendering, values, credentials);
if (parameters != null)
{
//look through each report parameter returned, and add to our list if not
//already in the list
foreach (ReportParameter rp in parameters)
{
if (!_customReportParameters.ContainsKey(rp.Name))
_customReportParameters.Add(rp.Name, new CustomReportParameter(rp));
}
Now that we know the parameters that are available in the report, we can use these parameters for Web Part Connections and Web Part Properties. We implemented the IFilterValues interface to support MOSS Filter Web Parts (Web Parts used to filter other Web Parts see MSDN for more details). To implement the IFilterValues interface, the Report Viewer Web Part must provide the filter value provider (e.g. Choice Filter Web Part) with a list of parameters which can be used to filter the report. Here is a simplified version of filling those parameters:
List<IFilterValues> _providers = new List<IFilterValues>();
[ConnectionConsumer("Parameters", "IFilterValues", AllowsMultipleConnections = true)]
public void SetConnectionInterface(IFilterValues provider)
{
if (provider != null)
{
//add this provider to our collection of providers
_providers.Add(provider);
//Call the ReportServices2005 web service to build a list of parameters
FillParameters();
//create a ConsumerParameter for each of our Report Parameters
List<ConsumerParameter> l = new List<ConsumerParameter>();
//iterate over each ReportParameter and fill the list of
//ConsumerParameters
foreach (CustomReportParameter crp in _customReportParameters.Values)
{
//Note: We are adding parameters by "Prompt" and not by
//parameter name
l.Add(new ConsumerParameter(crp.ReportParameter.Prompt,
ConsumerParameterCapabilities.SupportsAllValue |
ConsumerParameterCapabilities.SupportsMultipleValues |
ConsumerParameterCapabilities.SupportsEmptyValue |
ConsumerParameterCapabilities.SupportsSingleValue));
}
provider.SetConsumerParameters(new
ReadOnlyCollection<ConsumerParameter>(l));
}
}
Below is a Web Part Configuration dialog for the Web Part Connection between a Filter Web Part and the Report Viewer Web Part. Note, the code above provides the “Filtered Parameter” list. This particular report has both “Customer ID” and “Account ID” as available reporting parameters that can participate in a Web Part Connection.
Once the Web Part connection has been established, the Report Viewer Web Part retrieves the filter values from the IFilterValues provider. Below the FillParametersFromWebpartConnection method is called each time the Web Part is rendered to retrieve parameter values from the filter provider in order to build a query string. The query string is used to pass parameter values to the SSRS ASPX page, which is then rendered in the Web Part.
private void FillParametersFromWebpartConnection ()
{
//iterate through each provider
foreach (IFilterValues provider in _providers)
{
//now find our parameter and populate the values
//remember though, we have to search for it by Prompt
foreach (CustomReportParameter crp in _customReportParameters.Values)
{
//match up the provider with the report parameter by prompt
if (crp.ReportParameter.Prompt == provider.ParameterName)
{
if (provider.ParameterValues == null)
{
break;
}
else if (crp.ReportParameter.MultiValue)
{
crp.Value = "";
foreach (string val in provider.ParameterValues)
{
//encode to account for semi-colons in
//mutli-value selects
crp.Value += val.Replace (";",@"\;");
crp.Value += ";";
}
}
else if (provider.ParameterValues.Count > 0)
{
crp.Value = provider.ParameterValues[0];
}
//break out of the foreach loop;
//we have found the parameter
break;
}
}
}
}
Here is an abbreviated sample of building out the query string.
//fill parameters from web part connection, if any
FillParametersFromWebpartConnection();
//loop through each report parameter and build parameters on the query string
foreach (string paramName in _customReportParameters.Keys)
{
if (_customReportParameters[paramName].Value != null)
{
reportUrl += "&" + paramName;
reportUrl += "=";
reportUrl += _customReportParameters[paramName].Value;
}
}
Below are a series of screen shots showing the use of a MOSS Filter Web Part where it is connected to and providing parameters to the Report View Web Part. Below shows a Filter Web Part with preconfigured name/value pairs
Next, we use the Filter Web Part to the select a Customer
And after a customer is selected, you see the filtered report that uses the filter’s value.
Summary
In Summary, this solution leveraged the following to allow a quick turnaround:
- Use of existing Report Explorer and Report Viewer UI provided by SSRS Server through use of IFrames.
- Use of the SharePoint Web Part Framework to leverage Web Part Connections for connecting the Report Explorer to the Report Viewer and for passing in report parameters from Filter Web Parts yielding a richer user experience.
- Use of Web Services within Web Part Properties to dynamically provide configuration of Report Parameters.
- Use of Agile development techniques to build weekly solutions that could be tested and adapted to an enterprise grade solution in 3 weeks.
Key tools that helped in the Web Part Development were:
STS Dev – The STSDev tool is an excellent tool used to quickly create base SharePoint features which can be easily packaged into SharePoint solution files.
SharePoint Solution Installer – The SharePoint Solution Installer is a terrific alternative to stsadm commands. This tool checks for basic SharePoint prerequisites and will deploy or retract your solution using a friendly wizard based interface.
About the Team and Authors
Eric Bowden is a Senior Consultant with ThreeWill who implemented the Report Viewer features.
Tim Coalson is a Senior Consultant with ThreeWill who implemented the Report Explorer features.
Donna Hodges from Microsoft was the technical decision maker that was able to keep the team focused on getting the most bang for the buck.
Audie Wright from Microsoft was the business liaison that defined the business requirements, and ensured that the necessary resources from the client, and Microsoft were provided to effectively solve the business problem.
Tommy Ryan is a co-founder of ThreeWill who helped pull together the article with assistance from the project team and Danny Ryan.
mehr...PDC 2008: Announcing Azure Services Platform and Microsoft SharePoint ServicesToday, in Day 1 of the PDC Keynote, Ray Ozzie unveiled the Azure Services Platform. Azure makes it possible for developers to create applications and services that run in the cloud or to create web, mobile, or hybrid applications that extend the value of on-premises applications. To learn more about Azure, go to http://www.azure.com .
In the Azure Services Platform, a number of developer services were mentioned including Microsoft SQL Services, Microsoft Dynamics CRM Services & Microsoft SharePoint Services. Keep in mind that this not the same as Windows SharePoint Services 3.0 which shipped in Windows Server. Microsoft SharePoint Services is a developer service that will be available as part of Azure in the future.
The keynote also emphasized Microsoft’s investment in cloud applications that developers can extend and customize. Specifically, David Thompson (VP of Online Services) talked about Microsoft SharePoint Online and demonstrated how developers can write code against SharePoint Online web services as well as make customizations with SharePoint Designer. For example, using the Data View Web Part to surface data from an external source – this could be a web service living in Windows Azure. In fact, later in the week at PDC, there’s a breakout session that walks through the different ways SharePoint Online can be customized.
Here are answers to a few frequently asked questions:
What is Microsoft SharePoint Services in Azure?
In the future, developers will have access to SharePoint functionality in the Azure Services Platform (“Microsoft SharePoint Services”). With the flexibility to use familiar developer tools like Visual Studio, developers will be able to rapidly build applications that utilize SharePoint capabilities as building blocks for their own applications. Developers can expect a breadth of SharePoint capabilities across the spectrum of on-premises, Online and the Azure Services Platform.
Where can I find more information about Microsoft SharePoint Services in Azure?
We have not announced any further detail or release dates. We will release more information about this in the future.
How do developers get ready for Microsoft SharePoint Services?
Keep developing on SharePoint technology (MOSS, WSS, SharePoint Online)! You can learn more about SharePoint Development here.
Stay tuned for more news from the PDC 2008!
mehr...Prepare for the Upcoming Office SharePoint Server 2007 and Windows SharePoint Services 3.0 Service Pack 2Office Service Pack Team announced Service Pack 2 for 2007 Microsoft Office System. This new service pack will be released between February and April 2009. It will contain both client and server updates. Here are some of the SharePoint related topics that we will be expanding upon in later posts.
- Improved Read-only Content Databases
Whenever a content database is marked read-only, all of the site collections in that database are automatically marked as read-only. - ECM Performance and Manageability Improvements
Improved performance and manageability in variations, including STSADM commands for repairing links between source and target pages. - Improved Index Rebuild Timer Jobs
SharePoint content databases running in SQL Server 2005 will undergo an automatic index rebuild, which helps stop defragmentation, and stop the database from degrading in performance. - Upgrade Checker
This will scan your SharePoint farm in advance of applying SP2 and will provide feedback on the environments readiness to upgrade.
So please stay tuned!
Regards,
Jie Li & Dave Pae
SharePoint Technical Product Managers
mehr...Announcing New Daylight Saving Time Update for Windows SharePoint Services 3.0Daylight Saving Time (DST, in some countries it is called summertime) exists in many countries. The start dates and end dates of DST change from year to year, and countries may change their policies for DST occasionally. This DST update is an effort of SharePoint product team to reflect these new changes. It includes updated time zone definition information for the following countries:
- Iraq
- Argentina
- Chile
- Iran
- Morocco
- Pakistan
- Venezuela
For more detail of this update, please refer to
http://support.microsoft.com/kb/956612
The update can be download here: x86 x64
You can always refer to this article for Windows SharePoint Services 3.0 update deployment guidance.
Jie Li
Technical Product Manager, SharePoint
mehr...Best Wishes to Lawrence and Welcome to Dave!Lawrence Liu, who has been on the SharePoint team for over 3 years leading the SharePoint community effort, joined Telligent this week – a Microsoft partner. Many of you have probably worked or virtually interacted with Lawrence and know of his extreme passion for community development. In appreciation for all of his dedication and hard work, the SharePoint product management team would like to say a huge thank you for the last 3 years and wish him the best of luck!
So let me introduce myself… Dave Pae. After 7 years as a Microsoft technology specialist professional based in Pittsburgh working with customers & partners on SharePoint & Office technologies, I joined the SharePoint product management team in Redmond. And as of last week, Lawrence passed ownership of the SharePoint Team Blog to me. I want to thank Lawrence for passing the keys to the blog. I’m also building a strategy around SharePoint as an Office Business Application (OBA) platform. So stay tuned as I work to publish new blog content!
Cheers!
Dave Pae
SharePoint Technical Product Manager
mehr...TechNet Edge Videos with Michael Noel, Author of SharePoint 2007 UnleashedWith benefits ranging from increased server utilization, improved IT service levels, and overall IT agility – most SharePoint organizations are considering adoption of virtualization technologies in a SharePoint environment. Michael Noel, partner at Convergent Computing – a Microsoft Gold Partner and SharePoint MVP, speaks with us in a TechNet Edge video about running SharePoint components virtually. Specifically, he speaks with us about what technologies you might want to run virtually – and when. Michael also authored a recently released paper titled “Virtualization of Microsoft SharePoint Products and Technologies”, for more information on the topic.
While we had Michael in Redmond, we talked with him on a number of topics about managing your SharePoint environment including management of the virtualized SharePoint environment, data protection and disaster recovery for SharePoint, and monitoring. Look for those videos on TechNet Edge in the coming weeks.
Kelly Wagman
System Center Senior Product Manager
Microsoft Corp.
mehr...Some AAM guidance from the front linesThe ISA Server team recently wrote a nice blog post explaining some of the issues you may face when deploying SharePoint in an extranet. Many of these issues can be avoided by spending some time up front on planning and testing. Close collaboration between your firewall/proxy administrators and your SharePoint administrators during this phase is often the key to a smooth deployment. Here are some helpful articles on TechNet to get you started:
Troy Starr, Windows SharePoint Services Test
mehr...64-Bit and the Admin Toolkit Download Trend
[Cross-Referenced from Zach Rosenfield's Blog]
Just over a month ago I announced the release of the second Microsoft SharePoint Administration Toolkit. We’ve been getting great feedback and lots of interest—and I wanted to share our download results:

After 5 months we’re just shy of the 29,000 download mark, but more interesting is the disparity between x86 and x64 downloads. We feel like we often talk about the benefits of going 64-bit with your SharePoint deployments—but the download numbers above make us wonder if he advantages are really understood. I’ll take this opportunity to reiterate why we push all our customers to consider the switch to the x64 architecture.
What is wrong with 32-bit?
We’re not saying 32-bit is bad—it’s just that when Windows, IIS, CLR/ASP.NET, WSS, MOSS Core, SSP, and MDAC binaries are all loaded into memory (this is the initial footprint for MOSS 2007) it can leave a 32-bit address space quite fragmented (not to be confused with “too consumed”). When the CLR or SharePoint services request new memory blocks, it can be difficult to find a 64MB slice in the already loaded address space. Below is a snapshot of such an address space:

In many cases where customers are seeing bad performance—it’s not due to a lack of memory but a lack of enough continuous memory to serve additional requests.
Why 64 Can Help?
64-bit is not a cure-all to every performance issue but it does provide a practically unbounded address space for user mode processes. Therefore memory requests (even in 100’s of MB chunks) will not fail due to a lack of un-fragmented space. Not only will 64-bit significantly lower the problems you could potentially face, but once you get your servers into a constantly stable state mitigating other performance issues becomes a much easier task to achieve.
I just wanted to take this opportunity to thank you for your interest in the SharePoint Administration Toolkit and to remind you all to keep the benefits of 64-bit architecture in mind as you look to improve your SharePoint deployments and plan for the future. If you can’t switch immediately (and even if you can) you can still help yourself today by installing the Infrastructure Update and to look at the Best Practices Resource Center.
Zach Rosenfield
Program Manager, Microsoft Office SharePoint Server
mehr...Announcing August Cumulative Update for Office SharePoint Server 2007 and Windows SharePoint Services 3.0The Microsoft Office team has changed the way that it delivers hotfixes for reported problems. This change comes in the form of cumulative updates and critical on-demand hotfixes. The objective is to deliver high-quality fixes in an acceptable time and on a predictable schedule. Cumulative updates are scheduled for every two months, so customers can be better prepared to test and apply new updates. Those who need an emergency fix can request critical on-demand (COD) fix. For information, please refer to http://support.microsoft.com/kb/953878.
The detail of August Cumulative Update (CU) for Office SharePoint Server 2007 and Windows SharePoint Services 3.0 can be found here:
Description of the Windows SharePoint Services 3.0 hotfix package (Wssmui.msp): August 26, 2008
Description of the Windows SharePoint Services 3.0 hotfix package: August 26, 2008
Description of the SharePoint Server 2007 hotfix package: August 26, 2008
Customers are not needed to install these updates unless they are affected by specific problems described in the KB articles. And these cumulative updates will be rolled in to Service Pack 2.
To keep all files in a SharePoint installation updated, we recommend customers to follow the path below:
1. Windows SharePoint Services 3.0 Service Pack 1
2. The 2007 Microsoft Office Servers Service Pack 1
3. The Windows SharePoint Services Infrastructure Update x86 x64
4. The Microsoft Office Servers Infrastructure Update x86 x64
5. KB 953397: Excel Server Security Update x86 x64
6. KB 955586: Document Lifecycle Workflow Update
7. August Cumulative Update for Windows SharePoint Services 3.0 (Global)
8. August Cumulative Update for Windows SharePoint Services 3.0 (Local)
9. August Cumulative Update for Microsoft Office Servers
After applied all these updates, run SharePoint Products and Technologies Configuration Wizard or “psconfig –cmd upgrade –inplace b2b” in command line. This need to be done on every server in the farm with SharePoint installed.
The version of databases should be 12.0.6327 after all these updates.
For a better guided update process, customers would also like to check out the following guides. These articles provide a correct way to deploy updates, as well as known issues and how to do slipstream builds.
Deploy software updates for Windows SharePoint Services 3.0
http://technet.microsoft.com/en-us/library/cc288269.aspx
Deploy software updates for Office SharePoint Server 2007
http://technet.microsoft.com/en-us/library/cc263467.aspx
Jie Li
Technical Product Manager, SharePoint
_________________________________________________
Update: October Cumulative Update has been released on Oct 28th. Here're the download links and descriptions.
Cumulative update packages for the 2007 Microsoft Office core suite applications and for 2007 Microsoft Office servers: October 28, 2008
http://support.microsoft.com/kb/958847
Description of the Windows SharePoint Services 3.0 hotfix package: October 28, 2008
http://support.microsoft.com/kb/957691
http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=957691
Description of the SharePoint Server 2007 hotfix package (Coreserver.msp): October 28, 2008
http://support.microsoft.com/kb/957693
http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=957693
mehr...SharePoint Evaluation VPC Image will expire 9/30If you’ve activated and are using the SharePoint evaluation image from http://www.microsoft.com/vhd you’ve hopefully noticed by now that it’s due to expire at the end of this month…!
We’ll be getting a new image with an extended expiry date (Early 2010) uploaded to the same site in the next few days – I’ll update this post when it’s available.
If you have activated the original image and have been using it for demos or a POC you’ll need to download the new image and backup and restore your configuration, there’s no way to extend the expiry date.
And if you didn’t know that this SharePoint VPC existed then I’d recommend heading over to http://www.microsoft.com/vhd and taking a look, they have lots of other images available including Exchange, Vista and Windows Server 2008 – and all of them run fully functional for 30 days before requiring activation.
mehr...