Technology provides value to business by simulating and automating business processes. The measure of business software, whether client or web-based, is its ability to transform Business State A into Goal State B with the least amount of human intervention. Done right, it's about process engineering, not decoration. Business fundamentals haven't changed in ten thousand years, but they're accelerating as we automate. This rule never breaks.
Maybe it's just me, but I can't remember an instance where sticking plastic hearts or stars on file folders helped me find "good content" faster. To each his own criteria, yours probably isn't mine (also a rule by the way). The little green "this answer solved the problem" on Microsoft newsgroups gets it right for me maybe 25% of the time, it's not bad. I don't doubt it solved the thread for whomever put it there, but three out of four times the answer I need is either on some other page or isn't yet documented.
Now if social computing finds me an expert two floors up and down the hall who can solve Business State Q faster than I could with a coffee room bulletin board or a week of "asking around," fantastic. Type-written index cards with subjects (keywords) to cross-reference libraries, that was useful metadata. Top ten lists a la "here are the ten best books on subject x," those are great.
Which brings me to Twitter, which is where this train of thought began. I'm thinking "Links to links? Now that's just silly." I'll click three levels deep if there are actual choices along the way. Start me down a click tunnel and I'll avoid your links even if you one day find beer on Mars.
Is Twitter the Blackberry of blogs? The Blackberry turned e-mail into instant e-mail. Twitter instantly broadcasts the state of your ego (or web browser) to the masses in <141 byte-sized pieces. Like any good tool, it's exactly as useful as the person wielding it. When it simulates what goes on in the real world and makes it better by reaching the goal faster, it's good technology. When it's used to say "here's where I was today, maybe you want to go there too" it's about as entertaining and as productive as TV.
Eleven years ago on my first web page I joked that the Web was the bastard child of television and CB radio. Funny how we keep coming back to that. All I can add is that: if now you can use the rule of good technology to slice through junk and figure out which tools will help reach goals faster, then maybe you can figure out how to automate it.
Topic: SharePoint and Silverlight – Bringing the best of both worlds together!
In this session we'll explore different scenarios for integrating SharePoint 2007 and Silverlight. We’ll explore different ways on how you can leverage the SharePoint 2007 amazing framework to expose content and data in a much richer way.
Speaker:
Andy Nogueira (MCTS, MCPD, MCAD) has over 10 years of professional experience in the IT industry. He is the Team Lead for the Microsoft Practice Group at nonlinear creations Inc. (nonlinear.ca), a Microsoft Gold Partner. He is responsible for designing and implementing several successful technology solutions based on MOSS 2007 (Microsoft Office SharePoint Server) integrated with technologies such as Enterprise Search, Windows Workflow, K2, Windows Communication Foundation (WCF), and Silverlight. He is also a Microsoft Certified Technology Specialist (MCTS) in WSS 3.0 (Application Development) and MOSS 2007 (Configuration and Application Development).
Address: Nexient Learning
2 Bloor Street West, room 11 on the 8th floor
Time: 6:00pm
To RSVP, please email susie.ibbotson@cyberplex.com
Next Month: Mindsharp speaks on site planning and taxonomies!
At Infusion ASP.NET developers regularly ask how to easily build a web part or how to host a user control (.ascx) in SharePoint. Someone invariably replies "SmartPart!" at which point my job is to make sure they understand what they're getting into.
SmartPart is a cleverly coded web part by fellow MOSS MVP Jan Tielens. Once installed, you can drag an instance of SmartPart into a SharePoint web part zone and configure the new web part to host an .ascx file stored in the file system. And like magic, you can host user controls in SharePoint. Recent versions (v1.3+) are AJAX-aware, support web part connections, and improved the deployment story, and the underlying code is really quite good.
But, there are drawbacks, some of which may be overcome, some of which are realities.
1. SmartPart examples set web.config to Full
Trust. Not for the web part, but for the entire SharePoint application. You do not want to do this in Production, and happily this is avoidable. However, it does mean that you can't avoid the pain of creating a CAS policy (e.g. if your controls require access to the SharePoint API or unmanaged resources) by using the SmartPart.
2. SmartPart is an open source project, but the download contains only its classes so you can't compile it without some work of your own. If you work for clients who want to use SmartPart, I strongly recommend building your own SmartPart project as a starting point, and maintaining that code base as new features are added to the CodePlex project. While you won't "own" the code (copyright rules would say it's still Jan's and you should attribute it as such), you will now have full control and accountability for the code running on your servers, as it should be.
3. The SmartPart
disclaimer defines exactly what to expect should things go wrong, or should
you need to extend its capabilities: ". . . the Software comes 'as is',
with no warranties. None whatsoever. This means no express, implied or
statutory warranty, including without limitation, warranties of merchantability
or fitness for a particular purpose or any warranty of title or non-infringement."
Part of the license is to distribute this license whenever SmartPart is used.
To be fair, this disclaimer is similar to many software licenses, and all open source licenses. Linux is open source and offers no support. When things go wrong with Linux, Linus Torvalds will not show up at your door to hold your hand. To make Linux palatable for Production, Red Hat sells support. If you pay extra, they may even hold your hand.
SmartPart carries no support, and
no commercial version exists that would provide support. But, if you follow the advice of the last point and create you own project so you have control of the code, you can support your own. This is what you want to avoid: there was a period of
several months after GotDotNet was decommissioned and SmartPart did not yet
exist on CodePlex. During this time it was impossible to download any
"official" version of SmartPart, current or otherwise. had the source been released earlier (it wasn't) this wouldn't have inconvenienced anyone. From now on should the source become unavailable for any reason, you'll only have yourself to blame.
4. Building a custom web part that uses LoadControl() to host a user control is not difficult, and SmartPart's source code is a great way to learn how! The sample code below shows you how to load a user control and interact with its content from a web part, in this case to retrieve the content of a SharePoint list and implement paging.
Using the sample code
This is intended to roughly parallel the Smartpart - the user control will go into a usercontrols folder at the root of your application and the web part's assembly can be deployed to the GAC unless you'd like to write a CAS policy to deploy it to the bin folder.
Place the ascx in a \usercontrols folder into the Web Application's root (e.g. C:\Inetpub\wwwroot\wss\VirtualDirectories\80\usercontrols).
Create the web part, sign the project and add a line like this to the SafeControls section of web.config. Remember to replace the Assembly attribute with your own, best obtained by opening your assembly with Reflector:
<SafeControl Assembly="LoadControlWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=myToken" Namespace="LoadControlWP" TypeName="LoadControlWebPart" Safe="True" />
Then get your web part's assembly into the GAC and recycle the application pool, or build a CAS policy (if you control requires it) and place it in the web application's bin folder.
Sample code (LoadControlWP.cs):
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.WebControls.WebParts;
using System.Diagnostics;
using Microsoft.SharePoint;
namespace LoadControlWP
{
public class LoadControlWebPart : System.Web.UI.WebControls.WebParts.WebPart
{
private UserControl usercontrol;
private GridView gvDemo;
private const string defaultlist = "";
private string _listtolink = defaultlist;
protected DataTable dtDemo = null;
[Personalizable(), WebBrowsable(),
WebDisplayName("List to display"),
WebDescription("Name of the list in this site to display")]
public string ListToLink
{
get { return _listtolink; }
set { _listtolink = value; }
}
protected override void CreateChildControls()
{
try
{
base.CreateChildControls();
this.Controls.Clear();
this.GetData();
usercontrol = (UserControl)Page.LoadControl(@"/usercontrols/wpgrid.ascx");
gvDemo = (GridView)this.usercontrol.FindControl("gvDemo");
gvDemo.AllowPaging = true;
gvDemo.DataSource = dtDemo;
gvDemo.PageSize = 3;
gvDemo.PageIndexChanging += new GridViewPageEventHandler(gvDemo_PageIndexChanging);
this.Controls.Add(usercontrol);
gvDemo.DataBind();
}
catch (Exception ex)
{
EventLog.WriteEntry("WebParts", "UCWebPart" + ex.ToString());
}
}
void gvDemo_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvDemo.PageIndex = e.NewPageIndex;
gvDemo.DataBind();
}
private void GetData()
{
try
{
if (ListToLink.Length > 0)
{
dtDemo = new DataTable();
dtDemo.Columns.Add("Title", Type.GetType("System.String"));
SPWeb site = SPContext.Current.Web;
SPList list = site.Lists[_listtolink];
foreach (SPListItem item in list.Items)
{
DataRow newRow = dtDemo.NewRow();
newRow["Title"] = item["Title"];
dtDemo.Rows.Add(newRow);
}
}
}
catch (Exception ex)
{
EventLog.WriteEntry("WebParts", "UCWebPart - Retrieving items from " + _listtolink + "-" + ex.ToString(), EventLogEntryType.Error);
}
}
}
}
Sample code (wpgrid.ascx):
<%@ Control Language="C#" ClassName="WebUserControl" %>
<script runat="server">
</script>
<asp:GridView ID="gvDemo" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None">
<Columns>
<asp:BoundField DataField="Title" HeaderText="Title" />
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
I've updated the article on how to build a development machine for SharePoint 2007.
The best tool I've discovered is the SharePoint Manager 2007 which takes over from the SharePoint Inspector as the object model browser of choice.
Notable tools not yet on the how-to page are the U2U CAML Creator tool and Ms. White's Event Receiver Manager.
Several of the recommended tools were moved into a new optional section, the most notable of which is the VSeWSS component which I really can't recommend. There are so many better project templates available on CodePlex that the sole bright spot of VSeWSS is the Solution Generator. In another tragic turn, VSeWSS was "updated" and baked into VS 2008 in a way that actually made a few templates worse. So while the workflow designer is better, it's even harder to deploy your custom workflow to another machine now.
As always, if you see ways to improve this how-to guide I'd love to hear from you!
I've been head-down, full speed ahead, damn the torpedoes, coding like it's 1999, interrupted only by the 5-day odyssey that was the Worst Move Ever. Every other day it seems I've had a search that returned 5 or fewer hits, so obscure problems were encountered, and solutions and more will be blogged in the weeks ahead.
What's been going on in the outside world? Plenty. There's a Windows Server 2008 / SQL 2008 / VS 2008 launch event in Toronto this Wednesday. At MSFT, Scott Guthrie was promoted from GM to Corporate VP of the .NET Developer Platform, Soma is now Senior VP of Dev Div, and here in Canada Elizabeth Caley's purview moved beyond SharePoint to cover all of Office System. Last Wednesday Robin Macrae wowed the Toronto SharePoint User Group with a session on developing an enterprise strategy with SharePoint as its core platform, and
http://www.torontocodecamp.net/
"The Third Annual Toronto Code Camp, a free .NET community sponsored event, will be held on March 1st,
2007! Last years event was a huge success with over 350 attendees, 25
sessions, 24 speakers and 20+ volunteers. This year we will continue to
build on the success of the prior Code Camps and increase the number of
attendees and make the event an even greater critical and logistical
success."
Nadeem Mitha from Infusion will be there to talk SharePoint (a last-minute addition, his session may not appear until the event) as will SharePoint pros Reza Alirezaei (MOSS MVP), Bill Brockbank, CodeCamp organizer Chris Dufour, and a slew of other great speakers. I'll be dropping in to see friends old and new, but the dominant theme of my weekend will be R&R with my daughter.
Problem: The SPListItem.CopyTo() method doesn't seem to work on a custom list or custom properties. When called, CopyTo() returns the error "Source item cannot be found. Verify that the item exists and that you have permission to read it."
Solution: Dorrit Riemenschneider posted this solution in German, which is roughly translated below thanks to Babelfish and a little of my own interpretation. Dorrit provides source code you can cut and paste, look for the section in italics near the end of his post:
http://www.communardo.de/techblog/2008/01/08/sharepoint-listenelement-splistitem-in-eine-andere-liste-kopieren/
Translation: SPListItem offers a CopyTo(destinationUrl) method that doesn't work, at least in my case (a custom list with custom properties and attachments, maybe I expect too much of SharePoint). Instead I receive the exception: "Source item cannot be found. Verify that the item exists and that you have permission to read it." A quick Google search revealed that other people had the same problem but no solution. And so I bring you a method that works.
The method takes the SPListItem and destination list as parameters, and returns a reference to the new list item.
First the method adds an item at the target location. Then it steps through and copies each field. Note that we can't copy read-only fields, and attachments require special treatment. Once complete, the target is written with Update() and a reference to the destination element is returned.
Enjoy!
The first meeting of TSPUG in 2008 will feature the return of Reza. Lately he's been working on custom authentication providers for SharePoint, and next Wednesday you'll learn just how easy these are to build and deploy (when you know the tricks; there are always tricks). See you there!
When: Wednesday, January 16, 6:00pm to 8:30
Where: 2 Bloor West (NW corner of Yonge and Bloor), 8th Floor
Topic: Custom authentication
providers in SharePoint 2007
Abstract: In ASP.NET 2.0 , there is an important
concept called the authentication provider model which is used for many new
features such as Membership and Role Management, Profiles, etc. Moss 2007 is built
on the top WSS 3.0 which is in turn built on the top of ASP.NET 2.0. This means
that both MOSS and WSS can utilize everything that ASP.NET 2.0 offers. In this
session learn how to create a custom authentication provider, how to set up forms
based authentication, get yourself familiar with issues/workarounds, manage
your custom profiles and finally how to leverage this solution to expose your
SharePoint sites to the external users. This session is targeted at both IT
pros and developers.
About the speaker: Reza (MOSS MVP,MCTS)is
currently working for Protech as
principal architect where he is in charge of architecting and implementing
various technologies to support the organization. Since 2001, his focus has been Collaboration platforms, Knowledge Management, and Business Process Management. Reza
frequently speaks on a variety of SharePoint related topics at user group
meetings and industry events. For his community involvement and contributions,
he was awarded the Microsoft MVP award for SQL Server Reporting Services (2004-2005)
and Microsoft Office SharePoint Server (2007-).
RSVP Here! (Link opens new e-mail)
The long arm of MSDN Canada reached out to me to do a Q&A on their Developer blog:
MVP Insider - Q & A with Eli Robillard
Biggest surprises? I can eat 102 popcorn shrimp in a single sitting, and refuse to shave until Pope Benedict canonizes James Brown as a saint.
For those of you who were looking forwad to see this one at TSP Camp, Josef will be presenting at the Toronto SharePoint Users Group on Wednesday!
The “Awesome Media Gallery” -- Extending SharePoint with Silverlight
Based
on the “SharePoint Silverlight Photoviewer WebPart” project on
Codeplex, this session will provide a brief introduction to Silverlight
programming with Blend and Visual Studio and then demonstrate how
integrate
it with SharePoint via a web part. (note that the Codeplex project is
currently broken due to changes in the Silverlight 1.0 RTM. I will have
working implementation ready for SharePoint Camp.
More Posts
Next page »