SP2010: Error when trying to add FBA user to sharepoint group

I ran into an error when I tried to add a FBA user (ASP.NET membership) to a SharePoint group. It told me: “The user or group ‘providername:username’ is unknown. at Microsoft.SharePoint.Utilities.SPUtility.FilterValidLoginName(String loginName, SPSite site)”.

Weird, because the exact same piece of code had worked properly in 2007 and even in 2010 beta. The only thing different was the site being setup to use claims based authentication instead of classic authentication.

After some research, I found out that the syntax for querying users is different when you’re using claims based authentication.

Instead of: “providername:username” you have to use: “i:0#.f|providername|username“. I’m not quite sure about the “i:0#.f” part and wether it will remain the same if you have multiple authentication providers for instance. Perhaps the 0 will become 1,2,3,etc. for subsequent providers. But at least I can add users to my groups again 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *