Feed Icon  

Contact

  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics

Tags

Open Source Projects

Archives

Ads

SharePoint Resources Updated

Posted in SharePoint | General at Thursday, May 27, 2004 10:41 AM Pacific Daylight Time

I've updated my SharePoint resources page to include some more blogs and webcasts. I've also added a link to Lamont Harrington's SharePoint resource page which has a ton more resources that the page I created. Take a look.

Also I spoke with the WebCast guys at Tech-Ed and it sounds like there is an RSS feed in the works for webcasts (and it will probably have categories). So hopefully keeping a list of SharePoint webcasts will get much easier soon.

Reporting Services WebParts Released

Posted in Reporting Services | SharePoint at Thursday, May 27, 2004 9:44 AM Pacific Daylight Time

I've just posted a walkthrough that explains how to install and configure the RsWebParts.

Reporting Services WebParts - Walkthrough

I've also just released the CAB file for the first version of the RsWebParts on the RsWebParts workspace. Please check them out and let me know what you think.

Reporting Services WebParts - Walkthrough

Posted in Reporting Services | SharePoint at Thursday, May 27, 2004 9:40 AM Pacific Daylight Time

In this article I'm going to walk you through how to setup the RsWebParts with SharePoint. The first thing you will need to do is download the CAB file from the RsWebParts workspace. The current version is 1.0.0.0. Next you will need to install the CAB file on your SharePoint server. NOTE: please test these on a development box first. Below are the step-by-step instructions to install the WebParts.

1) Save the CAB file to your SharePoint server in a place that is easy to find (I use c:\temp).

2) On the server, open a command prompt. If you haven't added the STSADM tool to your path environment variable, then you will need to navigate to [c]:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN in the command window (by using >cd program files, >cd common files, etc).

3) At the command prompt type stsadm -o addwppack -filename c:\temp\bml.rswebparts.setup.cab (changing c:\temp\ to the directory where you saved the cab file).

4) You should get a message telling you the wppack was successfully installed.

The next step is to start adding the parts to a page and then connecting them together. To do this you will need a WebPartPage in SharePoint. In the site menu click the create button and scroll down to the WebPartPage option. Create a new WebPartPage. I would suggest the layout that has three zones: header, left column, body. Now you can start adding the parts to your page.

You have a few options for how to put the parts on the page (they are under the Virtual Server Gallery). I would suggest starting with the RsExplorer WebPart since it allows you to explore all the folders and reports on your report server. But you can also start with the RsFolder view, which allows you to browse all the reports in a single folder, or the RsStaticReportView, which connects to a single report. You should use one of these three webparts on your page (note: you can use the other webparts without these, but it makes it more difficult to change the report).

Once you have one of these on the page you will need to set some properties to allow it to work. On the RsExplorer you will need to set the Server URL and the Folder Path. To do this click the down arrow on the RsExplorer WebPart and select Modify Shared Web Part (see image below).

 

In the Server Url box put the URL to your report server. For example, if your server was named ReportServerA then you would set this URL to http://reportservera/reportserver. The Folder Path is just the root path where the explorer will start at. The RsFolderView and RsStaticReportView have similar properties (FolderPath and ReportPath) which do the same thing. Once you click OK the WebPart should load up the list of reports and you should be able to browse around your report server.

The next step is to add some of the other RsWebParts. You can add the RsReportView (for viewing reports), RsReportExport (for exporting reports), RsReportInfo (for getting report details), and RsParameters (for setting report parameters). After you added these items to the page you will need to setup their connections before you can start using them. The steps to make these connections are outlined below.

1) Put the page into design mode by clicking the dropdown at the top and selecting design this page (see image below).

2) Click the down arrow on the Rs Report View web part and under connections select Connections, Consumes a row from, Rs Explorer (see image below). This connetion is what sets the report that the viewer will display.

3) Click the same down arrow on Rs Report View but this time choose Consumes a row from Rs Report Parameters. This connection determines what parameters the report will use to render the report.

4) Click the same down arrow once more, but this choose Provides a cell to and select Rs Report Export. This provides the Url that the viewer is currently using so that the export webpart can export it.

5) Click the down arrow on the Rs Report Parameters and select Connections, Consumes a row from, and select Rs Explorer. This allows the parameters to get the right parameters based on the report you've selected.

6) Finally click the down arrow on the Rs Report Info and select Connections, Consumes a row from, and select Rs Explorer. This allows the web part to display the report information.

You should now be able to select a report and have all the other parts display the correct information. Changing the parameter should change the report. You should also be able to export the report using the export webpart.

I hope you like the web parts! If you find bugs please report them on the workspace and if you would like to add features to the project please apply to join the workspace.

Cheers!

Reporting Services WebParts CAB File

Posted in Reporting Services | SharePoint at Wednesday, May 26, 2004 10:49 AM Pacific Daylight Time

I just posted the CAB file that is from the RsReportInfo WebPart that I demonstrated in the first Report Services WebParts article to the RsWebParts workspace. If you read the article but didn't feel like writing out all the code you can now download and install the CAB file to try it out. I'll be posted most of the code for the other parts during this week and I will post the full CAB file once I get that done.

ObjectSpaces... not till Longhorn

Posted in Sql and Xml | General at Wednesday, May 26, 2004 7:25 AM Pacific Daylight Time

For all the ObjectSpaces fans out there, it has been delayed.

Developers who have been following the evolution of "ObjectSpaces" – a technology effort building services supporting object representations of data in relational databases – will be interested to know that these efforts are being merged with the Windows code-named “Longhorn” object/data technology “WinFS”.

[via MSDN Data Access]

If you're at Tech-Ed and you're interested in ObjectSpaces, you should stop by the Data Cabana and give your good, bad, and ugly feedback to Andrew. You can also email him your feedback if you aren't at Tech-Ed.

And you should probably read the ObjectSpaces: Requiem:

But let us not shed a tear for the fate of a one so young, because it has found a new peace in the afterlife.  We must learn what we can from the lessons it has taught us, so that one day we will be ready to accept the teachings of others who come to us with new visions of hope and plans to achieve even greater deeds, to build upon all the goodness that once was and will be again. 

Back from Tech-Ed, SQL Server 2005 XML, and the RsWebParts Workspace

Posted in Sql and Xml | Reporting Services | SharePoint | General at Wednesday, May 26, 2004 2:59 AM Pacific Daylight Time

Well I'm back from Tech-Ed USA (already). My work only gave me the first two days off since I'm currently pretty busy. It was great to meet everyone. I spent a lot of time in the Data Cabana and that was by far the best part of the conference. I'm always amazed at how easy it is to talk to all the SQL Server/Data Access people (MVPs and MS). They are more than happy to answer any and every question and they do a great job at it. I'll post more about some of the things I learned at Tech-Ed later this week.

There is a new SQL Server 2005 XML article up on the XML Developer Center. Take a look. It is worth a read. [via Dare].

While driving home from San Diego (I live in Los Angeles) I was thinking about my Reporting Services WebParts articles that I'm working on. I decided that I would probably get more done by sharing the code with a GotDotNet Workspace. So this morning I created the RsWebParts workspace and I'm planning on adding the source files this week. Hopefully the parts and the next article about them will be available by this weekend. If you want to collaborate on them with me apply to join the workspace and I'll be happy to add you.

 

At Tech-Ed

Posted in Sql and Xml | General at Monday, May 24, 2004 6:31 AM Pacific Daylight Time

Well I finished my first data cabana session. I handed out a lot of cool SQL Server 2005 trucker style hats and Reporting Services T-Shirts. There were a handful of questions about various SQL Server technologies and I enjoyed meeting everyone who came by.

Now I'm sitting the the ARC300 session titled Metropolis: Towards a Service-Oriented Architecture by Harry Pierson. I'm hoping it will be interesting, but if not I'm planning on moving down a few rooms to the 64-bit Sql Server talk.

Tomorrow I'll be at the Data Cabana (it is cabana 9) from 12:30 - 2:30 so come by and say hi.

ActiveViews FAQ

Posted in Reporting Services at Thursday, May 20, 2004 8:10 AM Pacific Daylight Time

From Tim Rizzo:

Q) How can I get a copy of the ActiveViews code?
A) Email me to add your name to the potential beta list (thomriz@microsoft.com).  I can't guarantee whether you'll get on it but if you don't email, there's no chance you'll make it :)

Any other questions on AV/Reporting Services, let me know.

I'm looking forward to the beta!

Apprentice.NET

Posted in General at Thursday, May 20, 2004 1:37 AM Pacific Daylight Time

More Tech-Ed via Scott Hanselman:

You'll want to stop by and see if you have the intellectual horsepower it takes to be the Apprentice.NET!  The Winner will receive a ticket to the EXCLUSIVE INVITE ONLY .NET Influencer's Dinner and rub elbows with various .NET Illuminati.  Truly a lifetime chance, and only possible to those with chops enough to be the Apprentice.NET. 

See you at Tech-Ed

Posted in Sql and Xml | Reporting Services | General at Wednesday, May 19, 2004 3:00 AM Pacific Daylight Time

I'm going to be at Tech-Ed, but only on Monday and Tuesday (due to work). I'll be answering SqlXml questions in the Data Cabana on both Monday and Tuesday during lunch (I don't remember the exact schedule). So if you have some SqlXml questions come by and ask them. If I can't answer them I'll pass them along to Irwin or Michael and maybe they will be able to answer them in the Irwin's SqlXml talk or one of Michael's talks.

See you there!

P.S. - I'm still working on part 2 of the RS WebParts article. It is about half finished. It is going to cover the RS Report Viewer WebPart and the RS Server Explorer WebPart and it will connect the three (including the RS Report Info part) together. I'll try to get it out before the end of the week so that you can ask me questions about that too (if you have any).

 

Updating thousands of records

Posted in Sql and Xml at Friday, May 14, 2004 2:21 AM Pacific Daylight Time

Dino Esposito asks How to update a few thousand records?

I hoped some hack was possible in 1.x to force a custom batch update size. My hope was for a private, internal property to set using reflection. No way. And in 2.0, the batch update implementation is significantly different and concatenates more statements into a SQL batch.

Have you tried with SQLXML updategrams? Any real-world feedback from large scale projects? 

This is something I plan on looking at real soon as one of the applications I'm working on will need to do some batch updating. Since the data I have is in a DataSet I was thinking of trying to use the SqlXml BulkLoader. If I come up with a SqlXml type solution I will be sure to post it as an article.

Who's Online

Posted in SharePoint at Thursday, May 13, 2004 7:31 AM Pacific Daylight Time

I just posted another article that details how to futher extend SharePoint using the global.asax file. This article shows how to create a who's online webpart using the methods from the first article.

Extending SharePoint using Global.asax - Who's Online

Extending SharePoint using Global.asax - Who's Online

Posted in SharePoint at Thursday, May 13, 2004 7:28 AM Pacific Daylight Time

In my last article on this subject I explained how to add some basic page tracking to SharePoint. In this article I will expand on this by adding a Who's Online WebPart. This WebPart will show who is currently online.

First we need to create the ActiveUsers table which will keep track of the users that are currently online. We also need to modify the Hit_Add stored procedure to update the ActiveUsers table. Finally, we need to create a very simple stored procedure to get the list of users that are currently online. Below is the SQL script for these tasks.

create table ActiveUsers ( UserID varchar(50) not null, LastHit datetime not null, LastUrl varchar(256) not null, constraint PK_ActiveSessions primary key clustered ( UserID ) ) go alter proc Hit_Add ( @Url varchar(256), @UserID varchar(50) ) as -- this needs to be changed to the userID -- that your site runs as if (@UserID = 'DOMAIN\PROCESSID') return insert into Hits values (@Url, @UserID, getdate()) delete ActiveUsers where UserID = @UserID or datediff(mi, LastHit, getdate()) > 30 -- minutes insert into ActiveUsers values (@UserID, getdate(), @Url) go create proc ActiveUsers_Get as select UserID, LastHit, LastUrl, datediff(mi, LastHit, getdate()) Age from ActiveUsers go


That is all there is to tracking the users that are currently online. You can adjust the time by changing the minutes in the delete statement. Next we need to create our WebPart. The WebPart I'm going to show you is somewhat simple and just displays a list of users. You can easily add more functionality to it if you want. Below is the code for the Who's Online WebPart.

using System; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Web.UI; using System.Web.UI.WebControls; using System.Xml.Serialization; using Microsoft.SharePoint; using Microsoft.SharePoint.Utilities; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.WebPartPages; namespace Bml.Stats.WebParts { ///

/// Description for ActiveUsers. /// [ToolboxData("<{0}:ActiveUsers runat=server>"), XmlRoot(Namespace="SPSStats")] public class ActiveUsers : Microsoft.SharePoint.WebPartPages.WebPart { protected override void RenderWebPart(HtmlTextWriter output) { output.AddAttribute(HtmlTextWriterAttribute.Width, "100%"); output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0"); output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); output.RenderBeginTag(HtmlTextWriterTag.Table); output.RenderBeginTag(HtmlTextWriterTag.Tr); output.AddAttribute(HtmlTextWriterAttribute.Width, "100%"); output.AddAttribute(HtmlTextWriterAttribute.Valign, "top"); output.RenderBeginTag(HtmlTextWriterTag.Td); output.AddAttribute(HtmlTextWriterAttribute.Class, "ms-ls"); output.RenderBeginTag(HtmlTextWriterTag.Table); AddUserRows(output); output.RenderEndTag(); // table output.RenderEndTag(); // td output.RenderEndTag(); // tr output.RenderEndTag(); // table } private void AddUserRows(HtmlTextWriter output) { try { SPWeb web = SPControl.GetContextWeb(Context); using (SqlConnection cn = new SqlConnection("[Your Connection]")) { cn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandText = "ActiveUsers_Get"; cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { string userName = (string)dr["UserID"]; output.RenderBeginTag(HtmlTextWriterTag.Tr); output.AddAttribute(HtmlTextWriterAttribute.Class, "ms-lsmin ms-vb"); output.AddAttribute(HtmlTextWriterAttribute.Valign, "top"); output.RenderBeginTag(HtmlTextWriterTag.Td); output.AddAttribute(HtmlTextWriterAttribute.Align, "absbottom"); output.AddAttribute(HtmlTextWriterAttribute.Src, "/_layouts/images/perusr.gif"); output.RenderBeginTag(HtmlTextWriterTag.Img); output.RenderEndTag(); // img output.Write(" {0}", SPUtility.GetFullNameFromLogin(web.Site, userName)); output.RenderEndTag(); // td output.RenderEndTag(); // tr } dr.Close(); cn.Close(); } } catch (Exception exc) { output.Write(exc.Message); } } } }

Once you've compiled the WebPart and added it to the server you will need to make one change to your web.config file before the part will work. You will need to change the trust level from WSS_Minimal to WSS_Medium. This will allow the part to use the SQL Connection which isn't allowed in the minimal trust scheme. After you add it to a page you should see something very much like the following image.

As I wrote this WebPart I thought of a lot of other uses for the hits data such as a Favorites list (based on urls with the most hits), recently viewed pages, and others. There seems to be a lot you can do once you start collecting this data.

Reporting Services WebParts - Part II

Posted in Reporting Services | SharePoint at Wednesday, May 12, 2004 4:12 AM Pacific Daylight Time

This articles builds on Part I of the series where we developed a simple Reporting Services (RS) WebPart that displayed information about a RS Report. In this article we will look at building two more WebParts: the RS Server Explorer and the RS Report Viewer. We will also explore how to connect these parts together.

Before we create the first webparts, we should really create a new base class that we can use to put all the common functionality in. This will allow us to not repeat the same sections of code over and over. Below is the C# code for the RsBasePart.cs that you should add to your project. For now it just uses the ToolPart code to show the ToolPart on the top and it loads the common rs.js script file.

namespace Bml.RsWebParts
{
 public abstract class RsBasePart : WebPart
 {
  public override ToolPart[] GetToolParts()
  {
   ToolPart[] toolparts = new ToolPart[2];
   WebPartToolPart wptp = new WebPartToolPart();
   CustomPropertyToolPart custom = new CustomPropertyToolPart();
   toolparts[1] = wptp;
   toolparts[0] = custom;
   custom.Expand(0);
   return toolparts;
  }
  protected override void OnLoad(EventArgs e)
  {
   Page.RegisterClientScriptBlock("rs", Globals.GetResourceScriptTags("rs.js"));
   base.OnLoad (e);
  }
 }
}

You can now change the RsReportInfo WebPart to inherit from this base class by changing the class declaration line to read:

public class RsReportInfo : RsBasePart

The first WebPart we will create is what I call the RS Server Explorer WebPart. This WebPart can be used to browse the RS Server and select a Report to display in the RS Report Viewer WebPart (which we will create next). Just like the first WebPart we created, this WebPart will use a mixture of client side and server side programming. To get started, open your project and select Add New WebPart and name it RsExplorer.cs. Next delete all the code in the body of the RsExplorer class. The first thing we need to do is a property that we will use to configure this WebPart. This is shown below along with the class declaration:

namespace Bml.RsWebParts
{
 [DefaultProperty("Text"),
  ToolboxData("<{0}:RsExplorer runat=server>"),
  XmlRoot(Namespace="Bml.RsWebParts")]
 public class RsExplorer : RsBasePart
 {
  string _serverUrl = String.Empty;
  [Browsable(true), 
   Category("Reporting Services"), 
   DefaultValue(""), 
   WebPartStorage(Storage.Shared),
   FriendlyName("Server URL"), 
   Description("Server url such as http://localhost/reportserver")]
  public string ServerUrl
  {
   get {return _serverUrl;}
   set {_serverUrl = value;}
  }
 }
}

So now we can set the server url of the server that we want to explore.

Global.asax and SharePoint

Posted in SharePoint at Wednesday, May 12, 2004 3:19 AM Pacific Daylight Time

I just posted a short article on Extending SharePoint using Global.asax. I'm very excited about using this technique in order to accomplish some things that I was unable to accomplish with WebParts and Custom pages. Take a look and let me know what you think!

Extending SharePoint using Global.asax

Posted in SharePoint at Tuesday, May 11, 2004 11:03 AM Pacific Daylight Time

Have you ever wanted to do stuff with SharePoint sites that webparts just won't let you do? Here are a few things that I wanted to do in SharePoint that I knew I couldn't really do with WebParts or custom pages.

  • Better stats - the built-in stats are ok, but I want some better stats.
  • Register Users - I want everyone to have access to the site, but I would like to collect a little information about them before I give them access.

For this article I will just tackle the task of getting better stats about SharePoint usage, but you can easily apply the methods I use to do all kinds of things in your SharePoint application.

First off, you will need to do a little background reading on Global.asax (if you aren't already familiar with it). The Global.asax file allows you to write code against events that happen within an ASP.Net application. SharePoint is no different so you can write custom code and stick it in the Global.asax file and gain more control over your application.

Below is a quick and dirty solution for capturing information about how people are using your SharePoint site (or portal). Of course you can use the built in stats, however, I personally find those stats to be somewhat limited. The method below captures the URL the person went to, the timestamp of the request, and the UserID. What you can do is to add this code to a file called Global.asax and place it in the root directory of your site.

<%@ Application ClassName="Globals" language="c#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web" %>
<SCRIPT language="C#" runat="server">
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
  try
  {
    using (SqlConnection cn = new SqlConnection("[Your Connection String]"))
    {
       cn.Open();
          
       SqlCommand cmd = new SqlCommand();
       cmd.Connection = cn;
       cmd.CommandText = "Hit_Add";
       cmd.CommandType = CommandType.StoredProcedure;
       
       HttpContext ctx = HttpContext.Current;
       
       cmd.Parameters.Add("@Url", SqlDbType.VarChar, 256).Value = ctx.Request.Url.ToString();
       cmd.Parameters.Add("@UserID", SqlDbType.VarChar, 50).Value = ctx.User.Identity.Name;
       
       cmd.ExecuteNonQuery();
       
       cn.Close();
    }
  }
  catch (SqlException)
  {
 // Eat the exception so that the site is still usable
 // even if the stats go down from some reason.
  }
}
</SCRIPT>

Before you can use the script you will also need to create a table and a stored procedure to populate the table. Below is the SQL script to create both. You will need to put them in a custom database (I would not recommend putting them in one of the SharePoint databases).

create table [Hits] 
(
 Url varchar(256) NOT NULL,
 UserID varchar(50) NOT NULL,
 Timestamp datetime NOT NULL 
)
go
create proc Hit_Add
(
 @Url varchar(256),
 @UserID varchar(50)
)
as
 insert into Hits values
 (@Url, @UserID, getdate())
 
go

That's all there is to it. The AuthenticateRequest Event gets fired each time the user makes a request to the site. You make the call to the database here because in the BeginRequest event the user hasn't been authenticated yet. I'm not sure but I believe this is different from normal ASP.Net applications due to the way SharePoint handles the request.

I'm sure you can think of many other ways that this will be useful. I'll be looking forward to your comments and suggestions.

SqlXml - Now includes Sql Server!

Posted in Sql and Xml at Friday, May 7, 2004 7:09 AM Pacific Daylight Time

Irwin talks about the delta between Sql Server 2000 and Sql Server 2005 XML features.

Hopefully we'll be able to add a few more things to it to really make Sql Server 2005 special.  All leading toward my future plan - “SqlXml - Now includes Sql Server!” 

MSDN.TV: Developing Apps using Reporting Services

Posted in Reporting Services at Friday, May 7, 2004 2:10 AM Pacific Daylight Time
This episode provides an overview of Reporting Services and shows how to add reports to your applications, including how to design reports using Report Designer, call SOAP methods using Visual Studio.NET 2003 against the Report Server Web service, and integrate reports into Win Forms applications.

Catch it here.