Retrieving User Profile Properties for the Current User

Retrieving a user’s profile properties can be achieved with the following block:

(more…)

Creating Custom Profile Properties through Code (C#)

I recently needed to add several custom profile properties through a web part for tracking a users’ security preferences for a particular web application.

The following is the method used to create four new properties in the SSP:

(more…)

WSRP Toolkit for SharePoint

The Microsoft SharePoint Product Group has just announced the WSRP Toolkit for SharePoint.  What is WSRP?  From OASIS:

WSRP defines a set of interfaces and related semantics which standardize interactions with components providing user-facing markup, including the processing of user interactions with that markup. This allows applications to consume such components as providing a portion of the overall user application without having to write unique code for interacting with each component.

(more…)

Locating all of the Web Parts on the Current Page (C#)

The following snippet allows for locating all of the web parts on a given web part page (the sample is targeted at web parts of the type Microsoft.SharePoint.WebPartPages.ListViewWebPart)

string webUrl = SPContext.Current.Web.Url;

using (SPSite site = new SPSite(webUrl))
{
     using (SPWeb web = site.OpenWeb())
     {
          SPLimitedWebPartManager manager = web.GetLimitedWebPartManager(this.Parent.Page.Request.Url.ToString(), System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);

          SPLimitedWebPartCollection webPartColl = manager.WebParts;

          for (int i = 0; i < webPartColl.Count; i++)
          {
               if (webPartColl[i].GetType() == typeof(Microsoft.SharePoint.WebPartPages.ListViewWebPart))
               {
                    // do stuff
               }
          }
     }
}
Performance Optimization WordPress Plugins by W3 EDGE