Visual Studio 2013 Preview and Apps for SharePoint

In case you installed Visual Studio 2013 Preview onto a fresh machine (in my case Windows 8.1 Preview) and ran into one of the following problems when creating an App for SharePoint install the prerequisites mentioned below…

Problems on compiling the empty ASP.NET MVC (App for SharePoint template solution):

  • The type or namespace name ‘SharePointContextFilter’ could not be found (are you missing a using directive or an assembly reference?) …\Controllers\HomeController.cs
  • The type or namespace name ‘SharePointContextFilterAttribute’ could not be found (are you missing a using directive or an assembly reference?) …\Controllers\HomeController.cs
  • The name ‘SharePointContextProvider’ does not exist in the current context …\Controllers\HomeController.cs
  • The file “SharePointContext.cs” is missing in the root of your web application.

Installed the following prerequisites to solve the problem:

SharePoint: Why won’t you let me delete a column? A case of “Cannot complete this action.”

Today I deployed a custom SharePoint column and list definition to our productive systems and added some extra columns to test some functionality. I then wanted to delete them again. Boom: Error page. ULS told me: “Cannot complete this action. Please try again.“. Suffice to say: Trying again did not help.

Fired up the all-might Powershell and tried deleting the column from there:

PS C:\swFiles\DualConsult.SharePoint.SecretsList\Scripts> $field.Delete()
Exception calling "Delete" with "0" argument(s): "Cannot complete this action.
Please try again."
At line:1 char:14
+ $field.Delete <<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

Nothing obvious turned up in ye grande search engine so I had a look what was different about this list and other lists. Turns out I had created a custom content type for the list and it was the only content type on the list (the standard “item” content type wasn’t part of the definition). Since I had used this pattern before I didn’t suspect anything wrong, but since I was stuck I went ahead and added the “item” content type.

SharePoint 2010 - List Content Types

SharePoint 2010 - List Content Types

Tried deleting the columns again and voila it worked. Interesting side note: Once I removed the “item” content type again, I could delete the second column I had created without any problems as well. SharePoint, you are strange.

SharePoint PeoplePicker is not displaying any AD Users? or “Why can’t I add user permissions in WSS?”

Today I was assigned an incident where the SharePoint administrators could not add permissions to a WSS site for a specific Active Directory user. The problem was the People Picker was not displaying any users – it just said “User not found” regardless of which substring I entered (and I ensured the substring was present in an existing Active Directory user’s name).

There are a couple of resources on the net for:

  • People Picker only shows a partial list of AD users
  • People Picker only shows a list of AD in specific OUs
  • People Picker has a bad day and just doesn’t like you today

But none applied to or solved my problem, my PP didn’t show any error, it just didn’t find any users.

One clue was that directly after the installation it actually worked and since then “nothing had changed”. Two existing users that were added after installation were still in the PeoplePicker cache, so I confirmed that it must have worked at some time in the past.

In Event Viewer I searched for errors during of shortly after my searched, but nothing obvious appeared. I then filtered for only “errors and warnings” and those that happened after the installation date and (apart from the classic DCOM permissions errors under a 2008 R2 installation) it showed me that about 6 days after installation the server started having NETLOGON errors along the lines of “Computer could not be authorized.” This continued until today. Turns out for some reason the computer account of the server in Active Directory got screwed up and after

  • detaching the server from the domain
  • manually deleting the computer account in Active Direcotry
  • and rejoining the server to the domain

everything worked again as usual.

HTH, Alex