Thursday, 14 July 2011

How to determine if your 'Assigned To' field contains user(s) or group(s)

public override void ItemAdded(SPItemEventProperties properties)
{
 // Check that the item has been assigned to someone and that the ListItem isn't an empty one.
 if (properties.AfterProperties["AssignedTo"] != null && properties.ListItem.Name != null)
 {
  this.EventFiringEnabled = false;

  SPFieldUserValue field = new SPFieldUserValue(properties.Web, properties.AfterProperties["AssignedTo"].ToString());

  // Test for a user or group value (null indicates a group)
  if (field.User != null)
  {
   //user  
  }
  else
  {
   //group
  }
  this.EventFiringEnabled = true;
 }
}

Friday, 1 July 2011

A deployment or retraction is already under way for the solution

Find job like this:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN>stsadm.exe -o enumdeployments
Cancel it like this:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN>stsadm.exe -o canceldeployment -id "jobId"