Windows Update KB932596 and VMWare Server on Vista x64

I was surprised to see that after a major Windows update process (the August 14th one) my VMWare Server stopped working. It began to give this error in the System Event Log:

The VMware Authorization Service service depends on the VMware vmx86 service which failed to start because of the following error:
Windows cannot verify the digital signature for this file. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source.

I tried the usual trick (disabling driver integrity check) but it didn’t help.

The culprit is the Windows Security Update KB932596 (“Kernel Patch Protection Feature”). It reestablishes driver integrity check every time you reboot.

I uninstalled this update and rerun the trick. It is now working.

Enumerating User Profiles

I’ve been trying for a week to make a workflow activity that would parse all user profiles and find a user with a specific title. At first sight it’s a straightforward activity, instantiating a UserProfileManager from the current context and then doing a foreach loop.

Well, accessing user profiles requires an authorized user. In order to overcome this, in my activity I create a delegate that runs with elevated privileges (SPRunWithElevatedPrivileges method). I also instantiate a new SPSite context with the GUID of the SPSite already passed from SharePoint, because the original SPSite is associated with the caller identity, not the impersonated identity.

It didn’t work, either. I always got a “Access Denied: Only an administrator may enumerate through all user profiles.” error. Other people also got this error in the same circumstances (for example here). However, in my lab MOSS deployment (single-server) it worked OK. I was puzzled.

Thanks to my friend at Microsoft, Carlos, I was able to make it work.

The catch is that the impersonated user is the Application Pool identity. You have to assign to this account (NETWORK SERVICE in my case) two specific rights for Personalization Services Permissions (/ssp/admin/_layouts/ManageServicePermissions.aspx) at Shared Services administration page. Those rights are Use Personal Features and Manage User Profiles.

It worked!

Hide a field from NewForm.aspx

Updated (18/03/2008): There’s an extended custom web part made by Paul that does the same thing and much more. You can start reading from here.

I was faced with this problem lately: you have a optional field in your list that you’d like to leave hidden from the user (it’s used for workflow status keeping).

The first solution is to customize NewForm.aspx from SharePoint Designer and replace the default list form with Custom List Form, in which you can remove the fields you don’t need. The inconvenience is that you lose the ability to attach files to the list item. As I had to attach files to the list, this option was unacceptable.

Fortunately, there is another way to hide a field. You can customize NewForm.aspx and add a JavaScript code that hides the whole row the field is placed. I used the code snippet from SharePoint Designer blog and I came out with this small code block, to be placed on NewForm.aspx (or EditForm.aspx, as you wish).

You have to replace these fields (see the SPD blog entry for more information):

  • TAGNAME: HTML element that is being rendered (“SELECT“, “INPUT“…)
  • IDENTIFIER: SharePoint field type identifier (“TextField“, “DropDownChoice“…)
  • FIELD NAME: Display name of the field (e.g. “Status“, “Customer Name“…)

<script language=”javascript” type=”text/javascript”>

_spBodyOnLoadFunctionNames.push(“hideFields”);

function hideFields() {

var control = getTagFromIdentifierAndTitle(“TAGNAME”,“IDENTIFIER”,“FIELD NAME”);

control.parentNode.parentNode.parentNode.style.display=“none”;

}

function getTagFromIdentifierAndTitle(tagName, identifier, title) {

var len = identifier.length;

var tags = document.getElementsByTagName(tagName);

for (var i=0; i < tags.length; i++) {

var tempString = tags[i].id;

if (tags[i].title == title && (identifier == “” || tempString.indexOf(identifier) == tempString.length – len)) {

return tags[i];

}

}

return null;

}

</script>

Getting the SPUser out of SPFieldUser

SPFieldUser field type stores the username in “1#;User” fashion. This is a small annoyance when trying to access the user data, for instance when parsing “Assigned To” field of a Tasks list item.

This small amount of code will allow you to quickly get the underlying SPUser object. In this example, the SPFieldUser is the “Assigned To” column.

SPFieldUser assignedTo = (SPFieldUser)task.Fields[SPBuiltInFieldId.AssignedTo];

SPFieldUserValue user = (SPFieldUserValue) assignedTo.GetFieldValue(task[SPBuiltInFieldId.AssignedTo].ToString());

SPUser userObject = user.User;