1

I'm getting Windows users' profiles, in my webpart, doing the following:

UserProfileManager pm = new UserProfileManager(SPServiceContext.Current);
SPUser spuser = web.AllUsers.GetByID(user.Id);
UserProfile up = pm.GetUserProfile(spuser.LoginName);

When it comes to a FBA user, the second line will raise an exception. So, I guess there's another way to get FBA users' profile. Could anyone tell me how to do it?

Thanks!

  • which exception? – Steve B Jun 21 '12 at 20:13
1

Hi did you get anywhere with this? I have a similar problem, where the profile hasn't been created yet for the fba user so I'm trying to create it in code at the user creation level, but having no such luck. I've written a more complete post at: FBA User Profile Creation Access Denied

If anyone can help, that would be ace.

thanks, Bav

0

What is the user object? How is that loaded?

Instead of web.AllUsers.GetById, try web.SiteUsers.GetById. This will include all users in the site collection.

  • I get the user object from a parallel database (not the SharePoint one). – Brian Roisentul Feb 14 '12 at 13:02
  • and user.id is their SharePoint ID, i.e. 1, 2, 32, 100? – David Lozzi Feb 14 '12 at 13:19
  • Exactly. Anyway, I'm getting the same error doing what you suggested :S – Brian Roisentul Feb 15 '12 at 23:20
  • What's the error message? Do you have anonymous access enabled? – David Lozzi Feb 16 '12 at 1:16
  • I also wonder if you can use SPServiceContext.Current, since you're not running in context as I understand. Would be better if you could post the entire code snippet. – Jasper Apr 19 '12 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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