sharepoint 2010 - Changing the Fixed Keyword Query in search results core web part with the current user, (Author:{CurrentUser}) -


Is there a way to change the fixed keyword query in the search results core web part to get the current user ( Writer: {CurrentUser} )?

I've played with Scope and Filters and can fix it with the supply of certain keyword queries, but I am not able to always change it to get the current user.

Actually I would like to be a fixed -code area author: last first .

Here are some posts that indicate this but I would like to just change it in the XSL in the .aspx file and it will be done with it. to anyone?

OK so I've got "work around" for this . I will try and make as easy as possible

  1. Create a new ASPX page on which " is the core result Web Part " and the code in the properties set to " user query "> Cross -Web Part Query Id "under" Results Query Options ".
  2. We can refer to this page as" View Page Web Part " We'll call from inside, the wep part that will load the second page in an iframe. Then we will add the query to the URL of the page which will see the " page Loading in "Art " (like site.com/ourAspxFromStep1.aspx?k=author:first%20last )

    I hope It's obvious that I have added web parts with C # server side code dynamically based on the value of a list from a list on page load so that queries are dynamically generated on page load. There are comments or questions.

    Here is my client side function which I call the web part c The file that is mentioned above is in i core_wp_for_embed.aspx in step 1. Secure void refreshFeeds (string tmpUserName, SPUserToken userToken) {(SPS ite site = new SPS ite ("http: //www.site.com")) ({SPWeb web = site.OpenWeb ( )) Using {web.AllowUnsafeUpdates = true; SPFile File = Web Gatefile (web. Url + "/ current page .aspx"); (Using SPLimitedWebPartManager webPartManager = file.GetLimitedWebPartManager (PersonalizationScope.User)) {SPLimitedWebPartCollection webparts = webPartManager.WebParts; Int j = webparts.Count; For (int k = j - 1; k> = 0; k--) {microsoft. SharePoint Webpage page. WebProt WP = (Microsoft SharePoint WebPrint Pages. WebPart) [K]; If (wp.GetType (). ToString () == "Microsoft.SharePoint.WebPartPages.PageViewerWebPart") {webPartManager.DeleteWebPart (wp); }} // should clean the zone now loop through the list of users on the site and the web for each item SPS ite site 2 = new SPS ite ("http://www.site.com/personal/" + tmpUserName) Add Parts; SPWeb web2 = site2.OpenWeb (); SPList list = web2.Lists ["SomeUserList"]; Int i = 0; Foreach (SPListItem currentItem.Items in the list) {If (convert toBoolean (Current Entom ["BooleanField"]) == True) {PageViewerWebPart pvwp = New PageViewerWebPart (); Pvwp.Title = Current Itam ["Title"]. ToString (); Pvwp.ChromeState = System.Web.UI.WebControls.WebParts.PartChromeState.Normal; Pvwp.ChromeType = System.Web.UI.WebControls.WebParts.PartChromeType.TitleOnly; Pvwp.ContentLink = "http://www.site.com/core_wp_for_embed.aspx?k=scope:" + current ITEM ["item_soup"]. Toasting (); Pvwp.AllowEdit = true; WebPartManager.AddWebPart (PVWP, "SomeZone", I); WebPartManager.SaveChanges (pvwp); I ++; }}} Web.Update (); Web.AllowUnsafeUpdates = false; }} Response.Redirect (Request.RawUrl); }

Comments