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

We've been developing some app for SharePoint Foundation 2010 only and have some problems with profiles/users after sharepoint 2010 dev - whew is not User Profile Service Application in SPF 2010 :)

We want to add some new properties to user profile, but as I said where is no user profile service.

So, what is the best way to work with user profiles in SPF 2010 by c# code and can we replace standart edit/display pages for user profile or it isn't good way?

share|improve this question
    
we are also looking forward to use SP Foundation 2010 and import the contacts list form AD, but as you mentioned that is not really supported in Foundation. Just wondering if you have found any work around. Please share if you have or if someone else can give us some guidance on this. Thanks in advance! –  user3707 Jun 11 '11 at 11:45
add comment

1 Answer

What we did for a client is override the action a link to a userprofile has by using a control override (delegatecontrol). You could have the link redirect to a custom Contacts list in your site that holds all your users and then add extra properties to that list.

Feature / Elements xml:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control Id="ProfileRedirection" Sequence="90" ControlClass="CLASSNAME" ControlAssembly="ASSEMBLYNAME" />
</Elements>

Control class code:

using System;
using System.Globalization;
using System.Security.Permissions;
using System.Web.UI;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebControls;

namespace Intratuin.IntraWeb.WebControls.Profile
{
  public class ProfileRedirect : UserControl, IFormDelegateControlSource
  {
    [SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
    public void OnFormInit(object objOfInterest)
    {
      var user = objOfInterest as SPListItem;
      if (user != null)
      {
        RedirectIfNecessary(user);
      }
    }

    [SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
    public void OnFormSave(object objOfInterest)
    {
    }

    private void RedirectIfNecessary(SPItem user)
    {
      SPUtility.Redirect("DispFormOfYourContactsList", SPRedirectFlags.Default, Context, string.Format(CultureInfo.InvariantCulture, "id={0}", user["ID"])); //This is Case Sensitive
    }
  }
}
share|improve this answer
add comment

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.