Peter kulandairaj

Peter kulandairaj

  • NA
  • 10
  • 1.2k

How to write 'select * from table where condtion' query

Aug 20 2013 9:23 AM
[ToolboxItemAttribute(false)]
    public class AssignedToMeResults : CoreResultsWebPart
    {
        protected override XPathNavigator GetXPathNavigator(string viewPath)
        {
            // SPContext.Current.Web.CurrentUser.LoginName => "SHAREPOINT\\system"
            // SPContext.Current.Web.CurrentUser.Name => "System Account"

            // Read active AD User Name who logged in
            string adUserName = Page.User.Identity.Name;
            string[] fullName = adUserName.Split('\\');
            string domainName = string.Empty;
            string userName = string.Empty;

            if (fullName.Length == 2)
            {
                domainName = fullName[0];
                userName = fullName[1];
            }

            // Restrict the actual result and look for the property where user name is not
            QueryManager queryManager = SharedQueryManager.GetInstance(this.Page).QueryManager;
            queryManager.UserQuery = "FirstName:Peter";

            //queryManager.UserQuery = "SELECT FirstName FROM Scope() WHERE \"scope\" = 'All Sites'";\

                      
            return base.GetXPathNavigator(viewPath);
        }
    }

Answers (1)