Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can someone please guide me on How to sync user profiles from aspnetdb (FBA users)?

We do not have AD, So we need to Create and Sync the User Profile of Sharepoint with aspnetdb.

Just to add more information here:

We are migrating from WSS 3.0 to SP2010 EE.

share|improve this question

5 Answers 5

up vote 4 down vote accepted

I just resolved similar problem. After some researching and after reading Morten's answer I ended up with coding custom timer job.

You can apply standard FBA settings for Claims Based Authentication in machine.config (X:\\Microsoft.NET\Framework64\v2.0.50727\CONFIG) instead of changing IIS (Sharepoint) web.config and by doing so Sharepoint Timer Job Service (OwsTimer.exe) can access this settings by default.

After that you can use System.Web.Security.Membership (look at Morten's answer/code) in your custom timer job.

I will provide more details if needed.

share|improve this answer

It is not possible to configure the user profile synchronization service to import users from other sources than the built in synchronization sources (AD DS, Novell, Tivoli....)

I dont think it is possible to write your own synchronization connection - there are absolutely no documentation, and after having poked around i reflector for days i found no where to register such a synchronization source, and also it seemed like a lot of work - so that was a dead end.

In my case my users were provided by the SQLMembershipProvider, which stores the users in the aspnetdb - but you can use my approach on all membership providers.

You can get all users from a MembershipProvider by issuing the following command System.Web.Security.Membership.GetAllUsers(), if your application is configured to use your membershipprovider as default mebership provider.

Unfortunately this must be done in configuration (web.config, app.config). Because i did not want to mess with the Membership section of the OwsTimer.exe (Sharepoint timer job service) config file, i ended up doing the profile import from a windows service.

Basically you would create a new UserProfile manager and do the following:

foreach (MembershipUser user in System.Web.Security.Membership.GetAllUsers())
{
    //Get the claim for the user
    var claim = new SPClaim(
        SPClaimTypes.UserLogonName, 
        user.UserName, 
        "http://www.w3.org/2001/XMLSchema#string", 
        SPOriginalIssuers.Format(SPOriginalIssuerType.Forms, 
    System.Web.Security.Membership.Provider.Name))

    //Create or retrieve the user profile
    UserProfile profile = !userProfileManager.UserExists(claim.ToEncodedString()) ? 
        userProfileManager.CreateUserProfile(claim.ToEncodedString()) : 
        userProfileManager.GetUserProfile(claim.ToEncodedString());

    //Set profile properties

    //Commit
    profile.Commit();
}

Tadaa thats it

share|improve this answer
    
AD DS, Novell, Tivoli and SunOne are sources, but you left out LDIF, which I believe may be a possible solution to this. –  Tom Resing May 12 '11 at 2:54

This is a stretch, but I think you could do it using the LDAP Import from LDIF. LDIF is just a flat file format, but it's pretty simple. I'm sure you could expose your user data as LDIF. There are more details on TechNet and a summary on a technet blog post.

share|improve this answer

From a colleagues experience who tried to do this, and fialed, I think it is not possible. He ended up doing code to update users directly in code against user profiles

share|improve this answer
    
Thanks, Is that code available on the net? –  neo269 Apr 29 '11 at 7:54
    
I will ping my former colleague and ask him. –  Anders Rask Apr 29 '11 at 10:41
1  
We had similar situation with External HR DB and used PowerShell to update profiles... I am just not sure if this is the answer you are looking for... –  Toni Frankola Apr 29 '11 at 11:37
    
Thanks Anders & Toni –  neo269 Apr 30 '11 at 6:02

There is some video from AppDev showing how to do this staff. This is the content of the course: here. And in "Configure Forms Based Authentication with SQL Server" lesson they speak about how to make configuration and all the staff that you need .

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.