Old and Busted: 32 bit hardware; New Hotness 64 bit hardware

I am taking a class on Microsoft SharePoint architecture this week. I learned today in the class that the next version of SharePoint will be 64 bit only. If you are going to be buying new server hardware, get 64 bit hardware.

Not only does SharePoint run better on 64 bit hardware, so does MS SQL Server and ColdFusion. You can also take advantage of much more RAM. I believe that 32 bit hardware is limited to a maximum of 2-4 GBs. 64 bit hardware can go up to 256 Terabytes in theory.

SQL Saturday coming to Jacksonville

SQL Saturday is coming to Jacksonville on Saturday May 3rd, 2008. The conference will be held at the UNF campus.

The SQL Saturday conferences encompass one hour sessions on SQL Server and technologies used in conjunction with SQL Server.

I will be giving a couple of presentations this year at this conference. You can go and register now, and the registration is free.

Converting Image files in InfoPath to gifs once submitted

I have been developing a lot of windows workflows and web services in .NET recently. I came across a need to convert a WMF file (Windows Meta File) into a gif file. SQL Server Reporting Services can not display WMF files.

.NET 2.0 can convert and resize images natively. Here is how I converted the WMF files. First I added the following using statements;

using System.Drawing;
using System.Drawing.Imaging;

InfoPath saves images as Base64 strings, and .NET treats this as a byte array. So I had to convert the WMF byte array to a gif byte array.

byte[] imageByteArray = DiagramImage;
MemoryStream inStream = new MemoryStream(imageByteArray);
StreamReader myStreamReader = new StreamReader(inStream);
Image myImage = Image.FromStream(inStream);
Bitmap myBitmap = new Bitmap(myImage);
Graphics myGraphics = Graphics.FromImage(myBitmap);
//Keep background white. myGraphics.Clear(Color.White);
myGraphics.DrawImage(myImage, 0, 0, myImage.Width, myImage.Height);
MemoryStream outStream = new MemoryStream();
myBitmap.Save(outStream, ImageFormat.Gif);
byte[] gifByteArray = outStream.GetBuffer();

Sending Email with Attachments from Sharepoint Custom Workflows

I have been developing custom Sharepoint workflows in Visual Studio 2005 over the past year. It can be fustrating developing for Sharepoint 2007 because Microsoft has done a lousy job documenting the Sharepoint API.

The SendMail activity in the workflow tools does not allow for email attachments. I found a good work around is to use the .NET email API in a custom code activity.

[More]

Happy New Year

2007 has been an exiting year for me because of many changes in my life. The ColdFusion 8 launch was very exiting and has been successful for Adobe. I wish I had more time to devote to the JaxFusion user group this year to cover all of the new features.

I also started a new job working as a technical consultant. I did that to get more hands on experience using the BI features in SQL Server 2005. I also have had the opportunity to work with Microsoft Sharepoint and .NET this year. It has been great to learn new things related to these other products.

I just wanted to wish everyone a happy and safe new year.

Sharepoint 2007 Custom Workflow Initiation form Gotcha

I recently came across a nasty bug in Sharepoint 2007. When a custom workflow uses an intiation form to collect data for the start of a workflow, it will only collect this form when the workflow is run manually.

Workflow intiation forms can be created using InfoPath or aspx pages to collect data that can be used in the workflowProperties.InitiationData property. This form is only presented to the user when the workflow is run manualy in Sharepoint 2007. If you set the workflow to start automatically when an item is created or changed, Sharepoint will not present this form to collect the InitiationData.

There are a couple of work arounds you can use to get around this bug. One is you can set the InitiationData using an Association form when the workflow is first added to the Sharepoint list. You can also just make sure not to select the 'Start this workflow when a new item is created' or the 'Start this workflow when a new item is changed' check boxes.

Adding folders and files to Sharepoint document libraries

I am working on project now where we are creating reports and saving them to a document library in Sharepoint 3. I am automating this by using .NET code to create the subdirectories and files in the document library. I have not seen a lot of good code examples on how to do this on the internet, but this is how I am doing it in C#.

When I add a folder to the document library I used the following code;

SPSite mySite = new SPSite("http://sitename/");
SPWeb myWeb = mySite.AllWebs["mywebname"];

SPFolderCollection myFolderCollection = myWeb.GetFolder("http://sitename/sites/mywebname/PDF Reports").SubFolders;
myFolderCollection.Add("FolderName");

To add a file from a filestream, I used the following code;

FileStream stream = File.Create("report.pdf", result.Length);

SPSite mySite = new SPSite("http://sitename/");
SPWeb myWeb = mySite.AllWebs["mywebname"];

SPFileCollection destFiles = myWeb.GetFolder("http://sitename/sites/mywebname/PDF Reports/FolderName").Files;
destFiles.Add("report.pdf", stream, true);

stream.Close();

Sharepoint Workflow and the System.ArgumentNullException when referenceing the WorkflowProperties

I have been building Sharepoint Custom workflows this year and came across a nasty problem when I tried to reference the workflowProperties field in the onWorkflowActivated activity. I kept on getting a System.ArgumentNullException. The problem was actually a simple one to fix. I had not set the onWorkflowActivated property correctly to use the workflowProperties field. By the default when you replace this activity, it does not highlight that the workflowProperties need to be set to a field or property in your workflow.

Microsoft: Update Your Documentation in Your SDKs

I recently downloaded the Sharepoint 2007 SDK from Microsoft's web site. This article is available as part of the version 1.2 SDK that was recently released for Sharepoint 2007. This article includes code samples that do not work, and references an IDE, Visual Studio .NET, that is not used with SDK. If you read the community comments at the bottom of the article, they describe about how the article is "outdated". It looks like the examples were written for Sharepoint 2.0, and never got updated to 3.0.

Currently with the WSS 3.0 SDK, you do not have have to add all of the references at the top of the article. In Visual Studio 2005 with the 3.0 SDK, it creates the references to Sharepoint automatically, and it will automatically install the web part on the Sharepoint server if it is on the same machine with Visual Studio.

[More]

BlogCFC was created by Raymond Camden. This blog is running version 5.6.001.