Wednesday, August 4, 2010

Perform Partial Name search in SharePoint 2007

A lot of questions have been raised whether MOSS 2007 can support wildcards, suffix matchings, grouping of query terms, or logical operators. The truth is most of these deficiencies is not as result of the SharePoint engine but the fact that Out of the Box Web Parts do not expose these functionality on the User Interface.

A typical scenario when performing people search in SharePoint, users would like to search with partial names, like: You type in Bra on the search Box and you expect the search results to return: Bradley, Bramley, brambley, Brandon.
In SharePoint out of the box, there is no Web part that supports this. You basically have to type in full names like: Bramley to get any results.


To work around this issue follow this thought process:
On the people Search Web Part (Out of the box), type in your criteria, ensure you are using partial name not full name.




It will display a Peopleresults page. Note the URL displayed on the browser.



Then click on Search Options. Perform the same search again. Again enter the partial name in first name box, then perform search again.







Note that the search will launch PeopleResult page again. This time it places your search criteria in “ ” This is the source of the problem, see the figure below.





If you remove the “ ”. Meaning you just have FirstName:bra in the box and search again. The engine will return the results we want, it will work just as fine. At this point note the URLs:
If you type in your search criteria in the first name box, SharePoint will launch the following URL: http://servername:9090/SearchCenter/Pages/peopleresults.aspx?k=FirstName%3A%22Bra%22
Do you the same for the last name, the following will be launched
http://servername:9090/SearchCenter/Pages/peopleresults.aspx?k=LastName%3A%22Mae%22
Again it looks the problem is on the front end not the engine.
Solution: create a custom Web Part with 3 controls: firstname, Lastname and Search button.
Now you WebPart Solution should look as follows:



When the user clicks on Search, the Web Part will pass the text to the URLs below
When Search Button is clicked: Pass the inputs to this urls: http://servername:9090/SearchCenter/Pages/peopleresults.aspx?k=FirstName%3A%22inputText%22 for the first name. http://servername:9090/SearchCenter/Pages/peopleresults.aspx?k=LastName%3A%22LastNameInput%22
For the last name.


A typical method for Search will be:


void btnSubmit_Click(object sender, EventArgs e)
{
string getURL = string.Empty;
if (string.IsNullOrEmpty(lastNametxt.Text.Trim()) && !(string.IsNullOrEmpty(firstNametxt.Text.Trim())))
{
getURL = string.Format(Properties.Settings.Default.SearchURL+"FirstName%3A{0}", firstNametxt.Text.Trim());
}
else if (string.IsNullOrEmpty(firstNametxt.Text.Trim()) && !(string.IsNullOrEmpty(lastNametxt.Text.Trim())))
{
getURL = string.Format(Properties.Settings.Default.SearchURL + "LastName%3A{0}", lastNametxt.Text.Trim());
}
else if (!((string.IsNullOrEmpty(lastNametxt.Text.Trim())) && (string.IsNullOrEmpty(firstNametxt.Text.Trim()))))
{
getURL = string.Format(Properties.Settings.Default.SearchURL + "FirstName%3A{0}%20LastName%3A{1}", firstNametxt.Text.Trim(), lastNametxt.Text.Trim());
}
SPSecurity.RunWithElevatedPrivileges(delegate()
{
this.Page.Response.Redirect(getURL);
});
}
In your settings file define your searchUrl as : http://servername:9090/SearchCenter/Pages/peopleresults.aspx?k=
Please note you can simply hardcode the URL as: http://servername:9090/SearchCenter/Pages/peopleresults.aspx?k


In the Web part above you can simply type names like: Bra to return all related names such as Bramley, Bram, Brad,bradley, brandon and so on. In fact Bra* and Bra will return the same results.

I hope this saves someone time. I will look at the possible of packaging this solution.

Monday, May 17, 2010

Fixing 2010 Information Worker Demonstration and Evaluation Virtual Machines issues

Microsoft has made available the VMs for testing or training on SharePoint 2010. There are few challenges setting up some of this, especially if you do not have enough resources. This post aims to share some light on some of the issues discovered. Again if you not familiar with the VMs referred to here please click here http://www.microsoft.com/downloads/details.aspx?FamilyID=751fa0d1-356c-4002-9c60-d539896c66ce&displaylang=en .

The VM 2010-7a is in a saved state. The memory assigned to this VM is about 5120MB. This might be a little more than what you have on your environment. And obviously if you have no enough resources on your environment, you will get an error as shown below.







Now to change the memory for your new VM first delete your saved state by following the steps below. With your VM Manager open, select your VM then click delete saved state.












Then click on the settings













Click on the Memory, and change the settings. Hope you at least have about 4Gig of RAM. Then you good to go.

Sunday, March 28, 2010

Issues installing SharePoint 2010 Beta on Windows Server 2008 R2 and SQL Server 2008 R2

Hey Guys

I thought I should share some of my experiences on installing SharePoint 2010. As you know the product is not released yet, there is also limited installation information. I have recently after so many workarounds managed to install the Application on Windows Server 2010 R2, with SQL Server 2008 R2. The install was kinda buggy.

Well this is where I started.
1. Click on the SharePoint Installation file.
2. Installing SharePoint 2010, you need to install a number of prerequisites software. So to save yourself time, especially if you are connected to the internet. Click on Install software prerequisites














3. The following screen will display












4. Click Next, sharePoint will download, prerequisites software as shown above. But if your VM, dev machine is not connected to the internet, you will have to manually down these pieces software from the internet.

5. You may get errors such as the one shown below:









6. Do Panic, download the necessary prequisites, (You can ignore SQL 2008 R2 Reporting Services SharePoint 2010 Add-in, this is an optional component)when done, install SharePoint 2010
7. At this stage, your installation should go fine.
8. After installation run the SharePoint 2010 Products Configuration Wizard
9. If your configuration do not complete successfully, open the log file. Search for errors in the files. If you find anything like this:
03/28/2010 08:47:58 6 INF Entering function StringResourceManager.GetResourceString
03/28/2010 08:47:58 6 INF Resource id to be retrieved is PostSetupConfigurationFailedEventLog for language English (United States)
03/28/2010 08:47:58 6 INF Resource retrieved id PostSetupConfigurationFailedEventLog is Configuration of SharePoint Products failed. Configuration must be performed in order for this product to operate properly. To diagnose the problem, review the extended error information located at {0}, fix the problem, and run this configuration wizard again.
03/28/2010 08:47:58 6 INF Leaving function StringResourceManager.GetResourceString
03/28/2010 08:47:58 6 ERR Configuration of SharePoint Products failed. Configuration must be performed in order for this product to operate properly. To diagnose the problem, review the extended error information located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\PSCDiagnostics_3_28_2010_8_29_10_549_2104834801.log, fix the problem, and run this configuration wizard again.
03/28/2010 08:47:58 6 INF Entering function StringResourceManager.GetResourceString
03/28/2010 08:47:58 6 INF Resource id to be retrieved is PostSetupConfigurationFailedUserMessage for language English (United States)
03/28/2010 08:47:58 6 INF Resource retrieved id PostSetupConfigurationFailedUserMessage is Configuration of SharePoint Products failed. Configuration must be performed before you use SharePoint Products. For further details, see the diagnostic log located at {0} and the application event log.
03/28/2010 08:47:58 6 INF Leaving function StringResourceManager.GetResourceString
03/28/2010 08:47:58 6 INF Entering function TaskDriver.OnTaskDriverStop
03/28/2010 08:47:58 6 INF Sending a task driver stop event: TaskDriverEventArgs.EventCriticalityType error, TaskDriverEventArgs.EventType.stop, Configuration of SharePoint Products failed. Configuration must be performed before you use SharePoint Products. For further details, see the diagnostic log located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\PSCDiagnostics_3_28_2010_8_29_10_549_2104834801.log and the application event log.
03/28/2010 08:47:58 6 INF Entering function TaskDriverStateChange.Enter
03/28/2010 08:47:58 6 INF Acquiring the writer lock to change the state
03/28/2010 08:47:58 6 INF Current state of the task driver is neverrun. You want to change it to stoppedrunning

10. Do not panic, again, check if you have Geneva Framework installed (the version should be 1.0.x and above). If not download it from here: http://download.microsoft.com/download/8/6/6/866E86E1-2264-4C80-836A-92F3F3A3B1AB/release/MicrosoftGenevaFramework.x64.msi. See the comments by Bill Baer: http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/b3d31931-9d6b-4b68-8f7b-d8df55601beb/
11. After installation,try to configure SharePoint using the command tool. Open you command window. Navigate to your hive directory (%Program Files%\Common Files\Microsoft Shared\web server extensions\14\BIN\) psconfig.exe -cmd configdb -create -server app1 -database SharePoint_Config_Contoso -user contoso\mossfarm -password P@ssw0rd -admincontentdatabase Central_Admin_Content,

The above command created a server farm on a SQL Server instance named app1, with a configuration database named SharePoint_Config_Contoso. It also created a content database and embedded site collection for Central Administration

Special thanks to Ben Curry of this site:http://www.mindsharpblogs.com/ben/archive/2008/03/08/4411.aspx please note if you are installing as a single mode, remove the -user, and password attributes.
10. Now After the server farm is created, you need to provision Central Administration on at least one server in the farm. Yes, you have created in SQL Server, but you must still provision an IIS server to render the content. For this example, we will install on app2, the first server in the farm
psconfig.exe -cmd adminvs -provision -port 8090 -windowsauthprovider onlyusentlm
11. Administration, you need to install all services associated with your installed server role. We installed an APPLICATION server, so we should get all services installed.
psconfig.exe -cmd services install
12. Next, and VERY important, is setting the security on registry settings and the file system. If you do not do so, your installations will complete correctly, but you will have miscellaneous errors until the end of time, remove the installation, or until you simply run the command to fix your farm.
psconfig.exe -cmd secureresources
13. Now you almost done, test your central administration by browsing to http://servername:8090
14. At this stage your central administration should open successfully.
Please make sure that the account you has dbcreater and securityadmin roles in SQL.
You good to go.

Monday, February 8, 2010

Your licence for Office servers search has expired

I came to work this morning and found complains from a number of my users who could not utilize Search functionality in SharePoint 2007 instead they will get this error: "Your licence for Office servers Search has expired".

Quickly to diagonize the issue I browsed into my central administration. Click on Operations -> then Convert License Type under upgrade and Migration. Well, if you see this "Office SharePoint Server Trial with Enterprise Client Access License" on current License area. You probably installed SharePoint 2007 Service Pack 2, described in the KB here: http://support.microsoft.com/default.aspx/kb/971620.

Now what you need to do is to input the valid license click on OK. Then reset iis on all the web servers. See this blog for details http://blog.laksha.net/2009/12/sharepoint-your-licence-for-office.html. Then you good to go.

Tuesday, January 5, 2010

Wireless not detected on Windows Server 2008

Folks as part of SharePoint 2010, I have recently i7CPU Intel based Labtop. Now this guy is going to be my development box for SharePoint 2010. I have installed Windows Server 2008 Enterprise. I want to Add Hyper-V on top of this OS. Well the concept is I'm gonna have VM with windows server 2003, another one with Windows Server 2003 which will run SharePoint 2007. The final VM I want to build needs to run all the latest technologies including SharePoint 2010.

Now back to the Installation of Windows Server 2008 on my labtop, I have noticed that the Wireless was not picking up any network connections. I checked Network and Sharing Center but did not see anything odd. After searching around on internet, I decided to check roles and features. I noticed that the feature call Wireless LAN Service was not installed. Hmm, this is the cause of the problem. I followed the following steps to address this issue.
go to start ->Administrative Tools->Server manager
Click on the features, then click on Add Features, scroll down and check Wireless LAN Service
Then click OK

As I'm creating SharePoint Dev machines from the ground up on the Hyper-V. I'm expecting issues along the way. Please check this blog.