Error adding or removing user from site collection – Invalid e-mail

We started getting an error when we tried to add or remove users from a site collection. It happened to the site collection permissions, to groups and even to the Site Collection Administrators group.

The error message was that “nice” unexpected error has occurred popup with a correlation ID and in some cases it also showed “[E-Mail] – [Invalid E-Mail]”.

We also noticed that only the farm account had access the Site Settings page. All the site collection administrators got access denied to the Site Settings page but they could access other administrative pages. We have several web applications running on the same SharePoint 2010 farm and this was the only one with this error. We checked the users properties and they all had an valid email on the email field on their profile.

When searching for the correlation ID on the ULS logs we could find the following error entries:

03/14/2012 10:52:19.45 w3wp.exe (0x1CB0) 0x26A4 SharePoint Foundation Logging Correlation Data xmnv Medium Name=Request (POST:http://%5BWEB APP URL]:80/_layouts/mngsiteadmin.aspx) e4745c89-75e6-4027-9890-d77cea3c814a
03/14/2012 10:52:19.47 w3wp.exe (0x1CB0) 0x26A4 SharePoint Foundation Logging Correlation Data xmnv Medium Site=/ e4745c89-75e6-4027-9890-d77cea3c814a
03/14/2012 10:52:19.95 w3wp.exe (0x1CB0) 0x26A4 SharePoint Foundation General 8kh7 High [E-Mail] – [Invalid E-Mail] e4745c89-75e6-4027-9890-d77cea3c814a
03/14/2012 10:52:20.75 w3wp.exe (0x1CB0) 0x26A4 SharePoint Foundation General 8kh7 High [E-Mail] – [Invalid E-Mail] e4745c89-75e6-4027-9890-d77cea3c814a
03/14/2012 10:52:20.75 w3wp.exe (0x1CB0) 0x26A4 SharePoint Foundation Runtime tkau Unexpected System.Runtime.InteropServices.COMException: [E-Mail] – [Invalid E-Mail] at Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateMembers(String bstrUrl, UInt32 dwObjectType, String bstrObjId, Guid& pguidScopeId, Int32 lGroupID, Int32 lGroupOwnerId, Object& pvarArrayAdd, Object& pvarArrayAddIds, Object& pvarArrayLoginsRemove, Object& pvarArrayIdsRemove, Boolean bRemoveFromCurrentScopeOnly, Boolean bSendEmail) at Microsoft.SharePoint.Library.SPRequest.UpdateMembers(String bstrUrl, UInt32 dwObjectType, String bstrObjId, Guid& pguidScopeId, Int32 lGroupID, Int32 lGroupOwnerId, Object& pvarArrayAdd, Object& pvarArrayAddIds, Object& pvarArrayLoginsRemove, Object& pvarArrayIdsRemove, Boolean bRemoveFromCurrentScopeOnly, Boolean bSendEmail) e4745c89-75e6-4027-9890-d77cea3c814a

Nothing was very useful on the ULS logs and after searching on Google for a while we couldn’t find any reference to this error message. Then we decided to open a Microsoft support case.

Microsoft support was very responsive and called us back pretty quickly. After running several tests we found out that the issue was specific to one site collection. We then changed the ULS log level to verbose, restarted the SharePoint 2010 Tracing service on the web front end servers and repeated the add/remove user operations. One comment here: when you change the ULS log level to verbose the log files grow very fast, so right after the operations were done, we changed it back to our default level. Even doing this we still got 15 Mb log files.

The support engineer analyzed the log files and could tell us something was wrong with the content types for the site collection.

Checking the content types used on the lists for this site collection we found out the E-Mail site column has been edited to have validation applied and the error message for the validation was “Invalid E-Mail”. So we figured out  that SharePoint uses this same site column for the Email field on the User Information List and also use it directly or through the list for user authentication and user management on the site collection.  the add/remove operations and the login to the site were triggering the validation and throwing the error message. After removing the validation from the site column the site worked just fine.

We then came to 2 conclusions:

-The user permission assignment and the login processes use some of the site columns and try to validate the content types against the user information. We don’t understood why it happened but I don’t think it makes sense since .

-Never mess with the default SharePoint site columns because you never know how SharePoint uses them. They are not sample columns they created just to save you some time.

Thanks to the Microsoft Support Team for their efficiency and knowledge and thanks to @twlamb for your help on this debugging  task.

 

See you,

Amadeu.

Listing web parts used on all site pages using Powershell

UPDATED 2012-03-17: Added a link to the Powershell script file because the coded looked pretty bad on the post. lol

Powershell is pretty much the 8th wonder of the world, or at least, of my world. Almost everyday I learn a new trick I can do using Powershell.

A common problem for several SharePoint Administrators is to understand which web parts are used on their sites and how much they are used. The following script takes care of it going to all sites (SPWebs) on a web application and saving  to a text file all web parts found on existing pages.

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing")

function ListWebParts($web) {
if ([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web))
{
$webPublish = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$pages = $webPublish.GetPublishingPages()

foreach($page in $pages)
{
$manager = $web.GetLimitedWebPartManager($page.Url, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$webCollection = $manager.WebParts
if($webCollection.Count -ne 0)
{
for($i =0;$i -lt $webCollection.Count; $i++)
{
$sw.writeline($web.url + "/" + $page.url + ";" + $webCollection[$i].GetType().Name + ";" +    $webCollection[$i].Title)
}
}
}
}
}

function LoadSPSite()
{
$siteURL = "http://YOUR SITE'S URL"
$site = New-Object Microsoft.SharePoint.SPSite($siteURL)

foreach($web in $site.allwebs)
{
write-output $web.Title
ListWebParts($web)
}
$site.Dispose()
}

$sw = [System.IO.StreamWriter] "PATH TO LOG FILE"
$sw.writeline("Page URL;Web Part Type;Web Part Title")
LoadSPSite
$sw.close()

 

See you,

Amadeu.

Changing SharePoint 2010 Central Admin URL

When you run Central Admin in a load balanced environment, you should update the references to the Central Admin URL on your farm servers. The easiest way to do it is to update the Alternate Access Mappings and updating the URL on the servers using Powershell:

 

Getting the current Central Admin URL from the registry:
$oldValue = Get-ItemProperty -Path "HKLM:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\" -Name CentralAdministrationURL | select CentralAdministrationURL

 

Setting the Central Admin new URL:
$CentralAdminURL = "http://[Central Admin URL]:[Port]/default.aspx"
Set-ItemProperty -Path "HKLM:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\" -Name CentralAdministrationURL -Value $CentralAdminURL

 

 

See you,
Amadeu.