1

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?

1
  • 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, 2011 at 11:45

1 Answer 1

1

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
    }
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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