Free Microsoft Open Source Content Management
November 5, 2009
Microsoft is working on a set of free open-source content-management application and set of reusable components for it that is codenamed “Orchard.”
The company is slated to share details about its plans for Orchard at TechEd Europe next week.
I asked Microsoft officials for more information on Orchard and got back a no comment.
But here’s what is known so far about the project, courtesy of the session write-up from the TechEd site: [From Free Microsoft open-source content management app to get its debut next week | All about Microsoft | ZDNet.com]
Amazon: Windows 7 is Bigger Than Harry Potter
October 22, 2009
Windows 7 is the biggest grossing pre-order product of all time on Amazon.co.uk.
Publish InfoPath 2007 Form as PDF Programmatically C#
December 19, 2008
Simple way to publish a Infopath Form to PDF using C# and VSTA
Clients require the following download:
namespace Template_Test
{
///
///
///
public
partial
class
FormCode
{
///
/// Internal Startup
///
public
void InternalStartup()
{
EventManager.FormEvents.Submit += new
SubmitEventHandler(FormEvents_Submit);
}
///
/// Form Submit Event
///
///
///
public
void FormEvents_Submit(object sender, SubmitEventArgs e)
{
//SUGGEST WE FIND A SAFE AND PERSONAL PLACE TO STORE THE FILE, NO MUCKING WITH PERMISSIONS
string fileName = string.Format(@”{0}\{1}.pdf”, System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), “TestFile”);
//CHANGE THE VIEW TO THE REPORT VIEW (IF SUCH A THING IS DEFINED)
this.Application.ActiveWindow.XmlForm.ViewInfos.SwitchView(“Public”);
//EXPORT THE FILE TO PDF
this.CurrentView.Export(fileName, ExportFormat.Pdf);
//CONVERT THE FILE TO BINARY READING IT FROM THE APPLICATION DATA FOLDER
string base64 = ConvertPDFtoBinary(fileName);
//STORE THE FILE BLOB IN THE CURRENT XML DOCUMENT
StoreFileData(base64);
//TEST METHOD TO PERSIST THE FILE FROM BASE64
ConvertBinaryToPDF();
}
///
/// Store the File Data in the current xml structure as base64
///
///
string containing base64 data
public
void StoreFileData(string base64)
{
XPathNavigator navigator = this.MainDataSource.CreateNavigator();
XPathNavigator field = navigator.SelectSingleNode(“//my:assetTracking/my:fileStorage”, this.NamespaceManager);
//CHECK IF “nil” ATTRIBUTE EXISTS ON THIS NODE
DeleteNil(field);
field.SetValue(base64);
}
///
/// Check if the “nil” attribute exists on this node
///
///
Node to check
public
void DeleteNil(XPathNavigator node)
{
if (node.MoveToAttribute(“nil”, “http://www.w3.org/2001/XMLSchema-instance”))
node.DeleteSelf();
}
///
/// Convert PDF file to Binary string base64
///
///
Name of the file
///
public
string ConvertPDFtoBinary(string fileName)
{
System.IO.FileInfo fileInfo = new System.IO.FileInfo(fileName);
byte[] buffer = new
Byte[fileInfo.Length];
using (System.IO.FileStream fileStream = fileInfo.OpenRead())
{
fileStream.Read(buffer, 0, buffer.Length);
}
return System.Convert.ToBase64String(buffer);
}
///
/// Convert Binary base64 string back to a file and save in application data
///
///
/// This is simply a test method to prove the concept
///
public
void ConvertBinaryToPDF()
{
XPathNavigator navigator = this.MainDataSource.CreateNavigator();
XPathNavigator field = navigator.SelectSingleNode(“//my:something/my:fileStorage”, this.NamespaceManager);
string base64 = (field.Value as
string);
if (base64 is
string)
{
byte[] buffer = System.Convert.FromBase64String(base64);
using (FileStream fileStream = new
FileStream(string.Format(@”{0}\{1}.pdf”, System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), “TestFileFromBinary”), FileMode.CreateNew))
{
fileStream.Write(buffer, 0, buffer.Length);
fileStream.Close();
}
}
}
}
}
STSADM Template Names for creating sites
December 15, 2008
Can never find this when looking for it
GLOBAL#0 = Global template
STS#0 = Team Site
STS#1 = Blank Site
STS#2 = Document Workspace
MPS#0 = Basic Meeting Workspace
MPS#1 = Blank Meeting Workspace
MPS#2 = Decision Meeting Workspace
MPS#3 = Social Meeting Workspace
MPS#4 = Multipage Meeting Workspace
CENTRALADMIN#0 = Central Admin Site
WIKI#0 = Wiki Site
BLOG#0 = Blog
BDR#0 = Document Center
OFFILE#0 = Records Center
OFFILE#1 = Records Center
OSRV#0 = Shared Services Administration Site
SPS#0 = SharePoint Portal Server Site
SPSPERS#0 = SharePoint Portal Server Personal Space
SPSMSITE#0 = Personalization Site
SPSTOC#0 = Contents area Template
SPSTOPIC#0 = Topic area template
SPSNEWS#0 = News Site
CMSPUBLISHING#0 = Publishing Site
BLANKINTERNET#0 = Publishing Site
BLANKINTERNET#1 = Press Releases Site
BLANKINTERNET#2 = Publishing Site with Workflow
SPSNHOME#0 = News Site
SPSSITES#0 = Site Directory
SPSCOMMU#0 = Community area template
SPSREPORTCENTER#0 = Report Center
SPSPORTAL#0 = Collaboration Portal
SRCHCEN#0 = Search Center with Tabs
PROFILES#0 = Profiles
BLANKINTERNETCONTAINER#0 = Publishing Portal
SPSMSITEHOST#0 = My Site Host
SRCHCENTERLITE#0 = Search Center
SRCHCENTERLITE#1 = Search Center
SPSBWEB#0 = SharePoint Portal Server BucketWeb Template
Edit Page in SharePoint without the menu
December 5, 2008
Append this to end of the url ?PageView=Shared&ToolPaneView=2
Private Views are done as follows ?PageView=Personal&ToolPaneView=2
More on this can be found here http://blogs.msdn.com/danielmcpherson/archive/2004/10/11/240863.aspx
Found some javascript to add to favourites, not too sure they are but will dig em out and post it.
Install SharePoint Templates using Script
November 27, 2008
Place the scripts below in one
C# Timer Sample – Simple
November 24, 2008
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace WindowsTimer
{
class
Program
{
static
void Main(string[] args)
{
Timer timer = new
Timer();
timer.Elapsed += new
ElapsedEventHandler(timer_Elapsed);
timer.Interval = 1000;
timer.Start();
}
static
void timer_Elapsed(object sender, ElapsedEventArgs e)
{
Console.WriteLine(DateTime.Now);
}
}
}
Retrieving COM class factory failed due to the following error: 80040154
November 24, 2008
Vista x64 dev machine trying to do some COM interop for a RFID project. Annoying error but found the answer in the end…
WORKAROUND:
The possible workaround is modify your project’s platform from ‘Any CPU’ to ‘X86′ (in Project’s Properties, Build/Platform’s Target)
ROOTCAUSE
The VSS Interop is a managed assembly using 32-bit Framework and the dll contains a 32-bit COM object. If you run this COM dll in 64 bit environment, you will get the error message.
http://forums.asp.net/t/1119052.aspx

Cool Developer Tools
November 23, 2008
This is a comprehensive list…
Below are some of the ones I frequently use…
GhostDoc is a free add-in for Visual Studio that automatically generates XML
documentation comments for C#. Either by using existing documentation inherited
from base classes or implemented interfaces, or by deducing comments from
name and type of e.g. methods, properties or parameters.
http://www.roland-weigelt.de/ghostdoc/
SmartPaster
DebugView for Windows
http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
InfoPath 2007 Form Hosted in WPF as a Wizard Sample
November 13, 2008
After looking around there are few sample out there using InfoPath in various ways. My objectives are as follows:
- Keep all the cool features of InfoPath like integration with SharePoint and use them as standard.
- Harness the design Capabilities
- Exploit the ability to use Xml for all data without having to do too much
- Deploy versioned forms without having to redeploy the app
- Use an offline sync provision should it be required
This sample does not cover all of this but what it does show is how it can be done.
