I've moved my blog to http://www.zimmergren.net
Please update your feeds and bookmarks,
Thanks!
Author: Tobias Zimmergren
Url: /zimmer
Yep. It's me again…
I managed to salvage most of the data from the bluescreen a couple of hours earlier (due to the persistent use of source control).
I'll cover this topic more in details in one of the days to come, for now – this is what it looks like:
Please do comment!
Have a good night everybody! I sure will, now.
I completed my integration project with Silverlight 1.0 and SharePoint 2007 – which doesn't requiry any configuration on your server, except to install my Web Part with the .wsp solution.
But…
Instead of giving you a nice guide on how to implement and integrate Silverlight, Microsoft gave me a Bluescreen of Death smacked in my face when I was copying my files to the source control environment.
Anyhow, it's not such a big loss. I think most of the things are checked into the Source Control environment already, so i just need to set up a new VPC – seeing as this one doesn't even start anymore :S
Hang in there a few days and you'll have your Silverlight 1.0 integration served on a Silverplate!
Keep in touch.
Author: Tobias Zimmergren
Url: /zimmer
I got the question last week weather it's possible to get items from all lists of <your chosen type here> gathered and displayed on one page.
This is – like most things – possible in SharePoint without any greater efforts. With something called Queries we can use the object model to query SharePoint and get a result quite painlessly.
To demonstrate a very simple example, I've created a very small usercontrol (for use with Jan Tielen's SmartPart) that looks like this:
This code will combine all the items in all of the TaskLists on the current SiteCollection and display them in a simple GridView as seen above in the screenshot.
Simple enough, huh?
Of course you can create webparts, usercontrols, application pages, or any other type of application to interact with the object model in this way. I chose to do it using a UserControl for the ease of deployment, testing, development and demonstration.
For your conveniance I've uploaded the UserControl (.zip) here so you can download it.
Author: Tobias Zimmergren
Url: /zimmer
Hi people, been really busy the last couple of weeks and havn't had the time to answer your mails nor write any new blogposts.
However, I just felt that I needed to get this link out there for you guys to check out in case you havn't already: http://www.ssblueprints.net/sharepoint/
"Open Source Source Code and Full Blueprint coming soon" – Sounds promising
While you check out that link, I'll try to figure out the topic of my next MOSS post
Author: Tobias Zimmergren
Url: /zimmer
I just read a post by Michael Gannotti which was about the new features from Windows Live. Now you can use Alerts on your blog/website so people can register/sign up to receive alerts when you make changes or adds new posts to your blog.
Read more on Michael's blog here
Author: Tobias Zimmergren
Url: /zimmer
Short post! I just bumped into this feature of the Windows Live Messenger application which enables you to actually add a web-based messenger to your site or blog.
Check out http://settings.messenger.live.com/applications/websettings.aspx to create one for yourself.
First off, click the little green MSN-guy (it's green if the person is online)
You'll get some dialogs asking you for either your Live Passport or if you'd like to be anonymous and then you need to enter a verification code. After that, you'll see the dialog below in a browser window, being able to chat with the person. If I'm online, you can try it out!
Author: Tobias Zimmergren
Url: /zimmer
If you've read my last two blogposts you already know how to configure ASP.NET 2.0 AJAX for your SharePoint Server and how do deploy a UserControl that uses AJAX functionality on you SharePoint Server.
You can find my previous articles here:
This blogpost shows a simple implementation of a UserControl that uses the Object Model to query the search service using a keyword and then using an UpdatePanel in AJAX to present the result to the user without any page reloads.
To make this work (in this case, since I'm deploying to the UserControls folder with inline code, not calling any own assemblies) you need to copy the two .dll files to your /bin folder of the WebApplication where you want to deploy this UserControl.
The reason that we copy these files to our deployment target's /bin is simply that I'm deploying locally to that WebApplication and some of the namespaces and classes that we need to use in order to be able to query the Search Object Model are availible in those assemblies. There's better ways to accomplish this, but to keep it simple I'm going with this approach.
For simplicity, I'll reference all the servercode inside the <script> block and not using a code-behind assembly.
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Import Namespace="Microsoft.Office.Server" %>
<%@ Import Namespace="Microsoft.Office.Server.Search.Query" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
It could look something like this:
<script runat="server">
</script>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<img src="http://zimmergren/hostedImages/ajax-loader.gif" alt="Searching…" style="border: 0px none #fff;"/>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
Enter a keyword to search for<br />
<asp:TextBox ID="tbSearchString" runat="server" Width="230px"/><br />
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
<asp:Literal ID="literalSearchResults" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
It could look something like this:
string outputResults = startTable;
ServerContext context = ServerContext.GetContext("SharedServices1");
KeywordQuery keywordQuery = new KeywordQuery(context);
keywordQuery.ResultTypes = ResultType.RelevantResults;
keywordQuery.EnableStemming = true;
keywordQuery.TrimDuplicates = true;
keywordQuery.QueryText = tbSearchString.Text;
ResultTableCollection results = keywordQuery.Execute();
ResultTable resultTable = results[ResultType.RelevantResults];
if (resultTable.RowCount == 0)
{
literalSearchResults.Text = "Sorry, your search didn't return any results";
}
else
{
while (resultTable.Read())
{
outputResults += string.Format(searchResultItem,
resultTable.GetString(5),
resultTable.GetString(2),
resultTable.GetString(6),
resultTable.GetString(8),
resultTable.GetString(3),
resultTable.GetString(4));
}
}
outputResults += endTable;
literalSearchResults.Text = outputResults;
}
catch (Exception ex)
{
literalSearchResults.Text = ex.Message;
}
}
Instead of going all crazy about how the code actually works with the Search Query Object Model, I'm just pasting the code here for you to try and will explain the Search Query Object Model in another article.
If you've configured AJAX and installed the SmartPart you should be all set and be able to use it. See this short post on using the SmartPart if you don't know already.
This is what it looks like when you hit the button (the red image spins around for 2 seconds (see the code, Thread.Sleep(2000)) to show how it will look if it's a heavy query and needs some loading time.
This is what the result will look like, note that everything is done within an UpdatePanel and we do not experience the page to reload, or any visual postbacks.
Author: Tobias Zimmergren
Url: /zimmer
This post merely shows you how you can use the AJAX functionality in SharePoint by using UserControls.
In the following sections I will describe how you an use the SmartPart by Jan Tielens to host your custom usercontrols in SharePoint. The SmartPart is widely used by a number of people. However, there's also the approach of writing your own wrapper if you want full control of your usercontrol wrapper. Liam Cleary has blogged about doing so here.
First off, we'll install the AJAX Control Toolkit
Download the AJAX Control Toolkit from here and extract all the files into any folder. Search for the AjaxControlToolkit.dll file and make sure you copy it to the same webapplication's /bin directory as you configured for AJAX use. This means that you simply copy the AjaxControlToolkit.dll file to e.g. C:InetpubwwwrootwssVirtualDirectories80in if that's the webapplication you've configured AJAX for.
It might look something like this:
Note: The only reason that I create an entire Web Site project is so I can test my UserControls and debug easily on my own development machine before I actually deploy them.
<script runat="server">
// If there were any server side code, it would go here since I don't use a code behind or pre-compiled assembly to host the code
</script>
Pick a date by clicking in the textbox!<br />
<asp:TextBox ID="TextBox1" runat="server"/>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server"
TargetControlID="TextBox1" />
The UserControl might look something like this when you add it to a page and run:
When you've copied the file to the UserControls directory, the SmartPart will automatically be able to find it.
Note: If you havn't added a ScriptManager to either the Masterpage or the default.aspx page, you'll need to use the SmartPart with AJAX instead. In my case I've already configured my masterpage to include a ScriptManager.
Now your AJAX-enabled UserControl is hosted within a wrapper webpart (SmartPart) and have full AJAX Extensions support.
Thanks for tuning in. See you soon!
Cheers!
Author: Tobias Zimmergren
Url: /zimmer
In this very short and straight-on post I'll just mention how you can configure your SharePoint installation to enable support for ASP.NET AJAX 1.0 since a lot of people have been asking me about it.
Locate your default web.config file (usually here: "C:InetpubwwwrootwssVirtualDirectories80web.config").
Edit the webc.config file according to this scenario:
<sectionGroup name="system.web.extensions"
type="System.Web.Configuration.SystemWebExtensionsSectionGroup,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral
PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting"
type="System.Web.Configuration.ScriptingSectionGroup,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler"
type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" requirePermission="false"
allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices"
type="System.Web.Configuration.ScriptingWebServicesSectionGroup,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization"
type="System.Web.Configuration.ScriptingJsonSerializationSection,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" requirePermission="false"
allowDefinition="Everywhere" />
<section name="profileService"
type="System.Web.Configuration.ScriptingProfileServiceSection,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" requirePermission="false"
allowDefinition="MachineToApplication" />
<section name="authenticationService"
type="System.Web.Configuration.ScriptingAuthenticationServiceSection,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" requirePermission="false"
allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
EDIT: Thanks to Hardik Bhilota for pointing out that I was missing a comma after the version number. Cheers
<add assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add name="ScriptModule"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<SafeControl Assembly="System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI"
TypeName="*" Safe="True" />
<system.web.extensions>
<scripting>
<webServices>
<!– Uncomment this line to enable the authentication
service. Include requireSSL="true" if appropriate. –>
<!–
<authenticationService enabled="true"
requireSSL = "true|false"/>
–>
<!– Uncomment these lines to enable the profile service.
To allow profile properties to be retrieved and modified in
ASP.NET AJAX applications, you need to add each property
name to the readAccessProperties and writeAccessProperties
attributes. –>
<!–
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
–>
</webServices>
<!–
<scriptResourceHandler enableCompression="true"
enableCaching="true" />
–>
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode"
type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx"
preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*"
path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode"
verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>
Save your web.config file, restart IIS (iisreset.exe for convenience) and enjoy your ASP.NET 2.0 AJAX 1.0 support in SharePoint.
This isn't a big deal to accomplish, so that's all you get from this blogpost.
In the next blogpost I'll talk about how you can easily create a UserControl, hosted with the SmartPart, with support for AJAX.