Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To inherit the ContentQueryWebPart just do this:</p> <pre><code>using System; using System.ComponentModel; using Microsoft.SharePoint.Publishing.WebControls; using Microsoft.SharePoint; using Microsoft.Office.Server.UserProfiles; namespace YOURNAMESPACE { [ToolboxItemAttribute(false)] public class CustomContentQueryWebPart : ContentByQueryWebPart { protected override void OnLoad(EventArgs e) { try { //Reemplazamos [UserContext:&lt;field&gt;] por su valor string val, field; UserProfile userProfile = getCurrentUserProfile(); val = this.FilterValue1; if (val.StartsWith("[UserContext:") &amp;&amp; val.EndsWith("]")) { field = val.Substring(13, val.Length - 14); this.FilterValue1 = userProfile[field].Value.ToString(); } val = this.FilterValue2; if (val.StartsWith("[UserContext:") &amp;&amp; val.EndsWith("]")) { field = val.Substring(13, val.Length - 14); this.FilterValue2 = userProfile[field].Value.ToString(); } val = this.FilterValue3; if (val.StartsWith("[UserContext:") &amp;&amp; val.EndsWith("]")) { field = val.Substring(13, val.Length - 14); this.FilterValue3 = userProfile[field].Value.ToString(); } } catch (Exception ex) { } finally { base.OnLoad(e); } } private UserProfile getCurrentUserProfile() { SPUser user = SPContext.Current.Web.CurrentUser; //Create a new UserProfileManager UserProfileManager pManager = new UserProfileManager(); //Get the User Profile for the current user return pManager.GetUserProfile(user.LoginName); } } } </code></pre> <p>In this example, I just added a filter to get a field from UserProfile like the original webpart does with querystring. What do you need exactly?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload