Skip to main content

Hi,

K2 did a wonderful thing in SharePoint integration, especially for the SmartObject Service definition.

In my project, I came across the need for grabbing information from SharePoint User Profile using SmartObject.

Is there already any ServiceObject for getting this job done?

Thanks!

Currently, there isn't but there are code samples on the web.  I saw a sample here.  However, this piece might be required to execute on the MOSS server itself.  You probably have to test it out to see if this is the case.


http://www.sharepointu.com/nicksevens/archive/2008/01/21/requesting-sharepoint-user-profiles.aspx



using System.Web;


using Microsoft.SharePoint;


using Microsoft.Office.Server.UserProfiles;


using Microsoft.Office.Server;


 


namespace Nick.Blog


{


    public class RequestUserProfile


    {


        public UserProfile GetUserProfile()


        {


            using (SPSite site = new SPSite("http://myserver.com"))


            {


                using (SPWeb web = site.OpenWeb())


                {


                    ServerContext context = ServerContext.GetContext(web.Site);


                    UserProfileManager upMgr = new UserProfileManager(context);


 


                    UserProfile profile = upMgr.GetUserProfile("accoutName");


 


                    return profile;


                }


            }


        }


    }


}


Reply