How install Office 2010 and SharePoint 2010 Service Pack 1

Yesterday SP1 for Office 2010 and the various SharePoint 2010 versions have been released.

You can follow the official guide in the post Office 2010 and SharePoint 2010 Service Pack 1 Availability, keeping in mind that it is strongly suggested to install the June 2011 Cumulative Updates also, as described in the post SharePoint 2010 SP1 and Post SP1 June 2011 CU. Or else you can follow the following guidelines.

Office 2010:

SharePoint Designer 2010:

SharePoint Foundation 2010:

SharePoint Server 2010:

C#: how associate string description to Enum types

If you need to associate string description to Enum types, you can add an attribute to each enum member, via the System.ComponentModel.DescriptionAttribute attribute.
So for example:
public enum MyEnum
{
[Description("desc A")]
memberA;
[Description("desc B")]
memberB;
}
 
Then, you can retrieve each member description with the following extension method:
public static string GetDescriptionFromAttribute(this Enum myInstance)
{
FieldInfo fi = myInstance.GetType().GetField(myInstance.ToString());
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attributes != null && attributes.Length > 0)
return attributes[0].Description;
else
return myInstance.ToString();
}

Querying StringCollections with LINQ

If you need to query StringCollections, or other non-generic collection classes, with LINQ, you have to use the Cast method, so, for example:

StringCollection myStringColl = new StringCollection("AAA", "BBB", "CCC");

var query = from x in myStringColl.Cast<string>()...

Creating XLS Files in C#

If you need to create XLS files in .NET, I suggest you to use the following open-source libraries:

Windows 2008: enabling multiple RDP connections

By default, Windows 2008 disables multiple RDP connections with the same user.

But you can enable them in this way: start up gpedit.msc, go to Computer Configuration\Administrative Templates\Windows Components\Terminal Services\Terminal Server\Connections\, find "Restrict each user to a single session" and disable. You can find more details in the post Enable Multiple Remote Desktop Connections in Window Server 2008.

Of course, if you're on a domain and want to apply it to multiple machines, you obviously need to make it a domain policy.

But if you have installed Terminal Services, please follow the guide in the article Enable Multiple Remote Desktop Sessions on Server 2008.

SharePoint: how update Created/Modified and Created By/Modified By fields

Here is a code fragment to update the created (creation date), modified (modify date), created by (author) and modified by (editor) fields:

SPFieldUserValue spUserAuthor = new SPFieldUserValue(web, spUser.ID, spUser.LoginName);
listItem[SPBuiltInFieldId.Created] = myDateTime;
listItem[SPBuiltInFieldId.Modified] = myDateTime;
listItem[SPBuiltInFieldId.Author] = spUserAuthor;
listItem[SPBuiltInFieldId.Editor] = spUserAuthor;
listItem.Update();

Cloning a VirtualBox virtual machine with snapshots

To clone a VirtualBox virtual machine with snapshots, the steps to follow are:

  • if needed, make a backup copy of the original virtual machine;
  • from the GUI, remove all the saved snapshots, so that you have the current state only;
  • clone the virtual disk using the CloneVDI tool, described in the article Copy and Clone Virtual Machines in VirtualBox with CloneVDI Tool, or execute the following command from the command line:
         vboxmanage clonehd OldDiskName.vdi NewDiskName.vdi
  • create a new virtual machine and import the cloned disk.

You can find a more detailed explanation in the article How to Clone Virtual Machine in Sun VirtualBox- Simple Steps.