Pages

Thursday, January 27, 2011

User not found after converting site to claims authentication

After upgrading to SharePoint 2010 and converting my main site to claims and performing
$w = Get-SPWebApplication "http://<server>/"
$w.MigrateUsers(True)
I started getting “User cannot be found” errors on all “Library Settings” or “Site settings\Workflow settings”
image
SharePoint logs showed the following
05/16/2010 12:37:59.84     w3wp.exe (0x0DC0)                           0x1184    SharePoint Foundation             General                           8nca    Verbose     Application error when access /_layouts/listedit.aspx, Error=User cannot be found.   at Microsoft.SharePoint.SPUserCollection.get_Item(String loginName)     at Microsoft.SharePoint.Workflow.SPWorkflowNoCodeSupport.LoadWorkflowBytesElevated(SPFile file, Int32 fileVer, Int32& userid, DateTime& lastModified)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.AddDeclSiteTemplates(SPWeb web, String visibility, SPWorkflowTemplateCollection wftemplates, SPListTemplateType templateType)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.RegisterNoCodeTemplates(SPWorkflowTemplateCollection wftemplates, SPWeb web)     at Microsoft.SharePoint.SPWeb.get_WorkflowTemplates()     at Microsoft.SharePoint.ApplicationPages.ListEditPage.SetSectionLinks()     at Microsoft.SharePoint.ApplicationPages.L...    e7a00359-5b0a-4fe2-a870-b38c91a57dbb
05/16/2010 12:37:59.84*    w3wp.exe (0x0DC0)                           0x1184    SharePoint Foundation             General                           8nca    Verbose     ...istEditPage.OnLoad(EventArgs e)     at ASP._layouts_listedit_aspx.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    e7a00359-5b0a-4fe2-a870-b38c91a57dbb
05/16/2010 12:37:59.84     w3wp.exe (0x0DC0)                           0x1184    SharePoint Foundation             Runtime                           tkau    Unexpected    Microsoft.SharePoint.SPException: User cannot be found.    at Microsoft.SharePoint.SPUserCollection.get_Item(String loginName)     at Microsoft.SharePoint.Workflow.SPWorkflowNoCodeSupport.LoadWorkflowBytesElevated(SPFile file, Int32 fileVer, Int32& userid, DateTime& lastModified)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.AddDeclSiteTemplates(SPWeb web, String visibility, SPWorkflowTemplateCollection wftemplates, SPListTemplateType templateType)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.RegisterNoCodeTemplates(SPWorkflowTemplateCollection wftemplates, SPWeb web)     at Microsoft.SharePoint.SPWeb.get_WorkflowTemplates()     at Microsoft.SharePoint.ApplicationPages.ListEditPage.SetSectionLinks()     at Microsoft.SharePoint.ApplicationPages.ListEditPage.OnLoad(EventAr...    e7a00359-5b0a-4fe2-a870-b38c91a57dbb
05/16/2010 12:37:59.84*    w3wp.exe (0x0DC0)                           0x1184    SharePoint Foundation             Runtime                           tkau    Unexpected    ...gs e)     at ASP._layouts_listedit_aspx.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    e7a00359-5b0a-4fe2-a870-b38c91a57dbb
Solutions:
USE [WSS_Content]
GO
/******* MODIFIED ********/
/****** Object:  UserDefinedFunction [dbo].[TVF_UserInfo_SiteLoginDel]    Script Date: 05/16/2010 13:01:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
            ALTER FUNCTION [dbo].[TVF_UserInfo_SiteLoginDel]
            (
                @tp_SiteID uniqueidentifier,
                @tp_Login nvarchar(255),
                @tp_Deleted int
            )
            RETURNS TABLE AS RETURN
                SELECT
                    *
                FROM
                    UserInfo WITH (INDEX=UserInfo_Login)
                WHERE
                    tp_SiteID = @tp_SiteID AND
                    tp_Login like '%' + @tp_Login AND
                    tp_Deleted = @tp_Deleted
The original function implementation is:
USE [WSS_Content]
GO
/****** Object:  UserDefinedFunction [dbo].[TVF_UserInfo_SiteLoginDel]    Script Date: 05/16/2010 13:00:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
            ALTER FUNCTION [dbo].[TVF_UserInfo_SiteLoginDel]
            (
                @tp_SiteID uniqueidentifier,
                @tp_Login nvarchar(255),
                @tp_Deleted int
            )
            RETURNS TABLE AS RETURN
                SELECT
                    *
                FROM
                    UserInfo WITH (INDEX=UserInfo_Login)
                WHERE
                    tp_SiteID = @tp_SiteID AND
                    tp_Login = @tp_Login AND
                    tp_Deleted = @tp_Deleted