Tuesday, September 20, 2011

How to carry out effective and efficient SharePoint searches


I have to admit. When I think about search, the first thing that comes to my mind is “Google” (or some people may even think about Bing or other search engines). Google has made searching very easy and very “fast”. And it has also made other search sites and tools look equally dumb and useless. So, an end user will open Google in one tab of the browser and SharePoint search page on another and type a query and compare the results. I am sure the person will be amazed by Google’s response time. But that does not mean that SharePoint search is weak and does not perform.

Users have to understand that there is a vast difference between Google’s infrastructure and the infrastructure of the organization they work in. Their own organization is hosting SharePoint for them (or sometimes may be it is hosted by another organization, but the point is that the infrastructure is still smaller than Google’s). So, the server capacity is limited, bandwidth is limited and storage is limited. Still, SharePoint manages to give results by just taking a little extra seconds than Google. So, I think that is commendable job from SharePoint’s point of view.

For all those who still do not like to search on SharePoint site, here are few tips that can help you get the results your are looking for in the first instance of your try. Try any or combine these tips below to narrow down the result set and get the results easily and in your first try.

Using Keywords:
Keywords are the basis of searching something. Consider you want to search for a H.R. document whose title is “Company HR Policies”. So, you can search for Policy. Searching with a single word may not give you the results.You can use phrase – Company HR Policy. SharePoint will now search for either Company or HR or Policy and return documents and items that contain any of these words. Exact phrases can  also be used like “Company HR Policy” (by specifying the quotation mark). This will search for exactly the phrase you have typed and in this case, you might get the first result as the document you were looking for. So, if you know the filename and want to search for it, use exact full phrases rather than loosely typed pieces of words.

But what if you do not know the filename but do know who wrote the document or what type of file it is. In such cases, Property Filters can be used

Property Filters:
When property filters are used while searching for content, SharePoint will limit the result set based on the matches between the data provided by you and the metadata properties of the file/item indexed by SharePoint.

e.g. You know that the document is written by a person named “Amol Ghanwat”, then following are few examples how you can use to search it.

author:Amol
author:”Amol Ghanwat”
author:”domain\username”

Note the use of quotation mark when multiple words are used.

In case you know the file type, you can search for document and limit the result set for those file type(s). e.g. if you are searching for Excel 2007/2010 file types, following query will yield only Excel files

filetype:xlsx

So, I mentioned earlier that you may not know the name of the document. But what if you know only a certain part of the filename or some other attribute. Prefix matching can be used to search for content for which you have incomplete information.

Prefix Matching:
You know that the file name starts with something like “Share….” but do not know the rest of the name. You can simply search for “Share*” (using the asterisk “*” symbol) and the search would return documents/item starting with “Share” e.g. SharePoint, ShareBook, etc.

Prefix matching can be used with property filters. e.g. You know that the content was written by a person whose name start with “Am” but do not know the last name, simply search for author:Am* and it would return documents with authors whose name start with “Am”

Note: As the name applies, “*” symbol can be used only as shown above. If you try to search something like “*Point” it will not return “SharePoint” in results. This is because wildcard characters are allowed only a
t the end when using SharePoint search.

Inclusions and Exclusions:
You are searching for a travel catalog and would like to find information about “Paris”, you can use inclusions as - Catalog + Paris or ”Travel Catalog” + Paris

This will ensure that the documents with “Catalog” or “Travel Catalog” with “Paris” are returned.

Similarly, if you would like that documents with “XYZPlace” in its name should not be returned, then we can query as - Catalog – XYZPlace

Boolean Expressions:
If there are multiple words or phrases in your query, you can use OR AND operations. e.g. If you want to search for a restaurant with the name ABC, you can search as restaurant AND ABC

Numeric Expressions:
Lets consider that you are an account executive and would like to search for accounts whose balance is less than 1000. In such cases, you are use Numerical Operators to compare values from SharePoint list/library/site columns. e.g. Accounts < 1000

Note that if Accounts is a custom column, your SharePoint site owner or administrator might have to request for this column to be mapped to metadata properties and crawled. If the metadata mapping is not done, then Numeric expressions will not yield correct results. Also, metadata mapping affects property filters.

Search Alerts
If you search for something very frequently and the main purpose of the search is to track which documents are added, removed, updated, etc, then you are use Search Alerts. When you search for something, the result page will contain links for Alert Me and RSS. Use any one of the links to keep yourself updated. e.g. If “ABC” was the first search result that used to come and after few days, “XYZ” relevance increases, it will show up first. Or a document named “PQR” was added and showed up in the search results. All these changes are summarized and sent across to you as RSS feed or as an email.

Monday, September 19, 2011

The sdk service is either not running or not yet initialized

I would like to bring out some points which can be used to troubleshoot issue related to System Center Operation Manager 2007 R2 SDK Service. You may get the below mentioned error while opening SCOM console, or on other services or applications (like SharePoint) where this data is being utilized. The problem lies with the SCOM server's sdk (System Center Data Access) service.

To analyze the issue further, we will need to reproduce the issue and check “Operations Manager” logs from event viewer on SCOM server.

Following are few possibilities/cause of the issue -
  1. If any of the following service is stopped.
    • System Center Management (Health)
    • System Center Data Access (SDK)
    • System Center Configuration (Config service)
  2. If any of the above service is stopped, please start the service. 
  3. Re-enter the password for the identity of above services and restart the service. 
  4. In case we are getting an error while starting the service, the reason might one of the reasons mentioned below
  • Incorrect SPN set for the account that is running the System Center Data Access (OpsMgr SDK) service. Need to find out what SPNs are set for the account and rule out any possibility of incorrect SPNs.
  • If SCOM is running on Windows 2003 SP1 and uses SQL 2005, we can also check the “SynAttackProtect” TCP registry as mentioned in the blog article below: http://blogs.msdn.com/b/sql_protocols/archive/2006/04/12/574608.aspx
  • Before making the above registry change, we need to ensure that we are getting System.Data.SQLClient.SQLException from Operations Manager event viewer logs. Event ID: 26380
  • If System Center Operations Manger 2007 R2 Authoring console is installed on System Center Operations Manager 2007 SP1 RMS or if there are errors related to assembly in event viewer, please check this article: http://support.microsoft.com/kb/2526827
  • Verify if the port numbers are same across the following registry key and SQL Server configuration manager settings for the SQL instance.
  • Registry Key Location: HKLM\Software\Microsoft\Microsoft Operations Manager\3.0\Setup\
    Check the “DatabaseServerName” key information.
    Match it with the port number specified in SQL Configuration manager for SQL instance. Both should be same.
    Related: http://support.microsoft.com/kb/2002620
  • Ensure that we are able to open SCOM Console on SCOM server.
  • Check for any handler or access denied errors in event viewer. If yes, then the SDK account might not have permissions on “Services Configuration” or SCOM installation directory.If starting a sdk service gives time out error, we can consider increasing the timeout for the sdk service – http://support.microsoft.com/kb/922918

Windows XP lifecycle to end in April 2014

The most successful Microsoft OS - Windows XP life-cycle should get over in April 2014 as per the statement from Kevin Turner.

"We are end-of-lifing XP and Office 2003 and everything prior, in April 2014," said Kevin Turner, Microsoft's chief operating officer, during a meeting with financial analysts Wednesday. "So for all those companies that have the old products that haven't quite started the refresh, guess what? This has been a great product, XP has been a wonderful product; great TCO has been given. It's now time for it to go."

Read more - http://www.informationweek.com/news/windows/microsoft_news/231601604

Friday, September 16, 2011

Batch file to delete files older than 2 minutes

Specify the directory where the files are located, save the file as .bat (batch) file and run it. When you run it, it will delete all the files which are older than 2 minutes

@echo off
cd "Directory where files need to be deleted"
setlocal
call :DateToMinutes %date:~-4% %date:~-10,2% %date:~-7,2% %time:~0,2% %time:~3,2% NowMins
for /f "delims=" %%a in ('dir * /a-d /b') do call :CheckMins "%%a" "%%~ta"
goto :EOF
:CheckMins
set File=%1
set TimeStamp=%2
call :DateToMinutes %timestamp:~7,4% %timestamp:~1,2% %timestamp:~4,2% %timestamp:~12,2% %timestamp:~15,2%%timestamp:~18,1% FileMins
set /a MinsOld=%NowMins%-%FileMins%
if %MinsOld% gtr 2 del %file%
goto :EOF
:DateToMinutes
setlocal
set yy=%1&set mm=%2&set dd=%3&set hh=%4&set nn=%5
if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)
set /a dd=100%dd%%%100,mm=100%mm%%%100
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633
if 1%hh% LSS 20 set hh=0%hh%
if /i {%nn:~2,1%} EQU {p} if "%hh%" NEQ "12" set hh=1%hh%&set/a hh-=88
if /i {%nn:~2,1%} EQU {a} if "%hh%" EQU "12" set hh=00
if /i {%nn:~2,1%} GEQ {a} set nn=%nn:~0,2%
set /a hh=100%hh%%%100,nn=100%nn%%%100,j=j*1440+hh*60+nn
endlocal&set %6=%j%&goto :EOF

At the start of the file, specify the directory where the files are located. If you need to change the number of minutes, locate "if %MinsOld% gtr 2 del %file%. Change the number of minutes. You can use this to schedule jobs and delete log files older than specified amount of minutes.

Visio Graphic Service Protocol

Visio Graphic Service Protocol is used to retrieve information about a Web Drawing (which is usually stored in a .vdw format) in a SharePoint document library. SharePoint as an application uses this protocol to retrieve data and display the graphic on the site. When we open a Visio diagram in SharePoint site, the Visio protocol client calls the server for information. The information is either returned in raster or vector format. Raster file data is returned as .png (portal network graphic) format while a vector data is returned as XAML.

Visio Graphic Services uses SOAP (Simple Object Access Protocol) for formatting request and response received from the server. The information is transmitted using TCP IP protocol (either through HTTP or HTTPS, depending on the way you have configured Visio Service Application). Following Diagram shows the messaging and transport stack used by the service.



Following are the pre-requisites for the service protocol to work properly:
  • Service endpoint. 
  • Appropriate permissions to call the method from VisioGraphicService.svc 
  • Token based security mechanism
SharePoint acts as the client requesting the information. Visio Service is hosted in a website known as “SharePoint Web Services”. The sub directory name is usually a GUID. Search through the contents of the site and you will find that VisioGraphicService.svc is hosted in one of the directories of the web application.


Open IIS Manager and check the Content view of the “SharePoint Web Services” web application. You should see a similar picture as above. The GUID might differ though.

VisioGraphicService.svc acts a a service endpoint and is needed to communicate and transfer data across. SharePoint Web Services web application uses TCP port 32843 (HTTP) and TCP port 32844 (HTTPS) for communication. Usually a default configuration of SharePoint uses HTTP port for communication unless you specific any other setting from Central Administration site.

Ensure we have these port(s) open. In case firewall is blocking the ports or you are facing any network issue, Visio diagrams may fail to refresh or may not render at all. Just in case, I am documenting some sample error messages I received because TCP 32843 port was blocked.

w3wp.exe Visio Graphics Service Web Access 8046 Critical Failed to get Vector Diagram for visio file (null) page (null) Exception : Could not connect to http://servername:32843/virtualDirectoryID/VisioGraphicsService.svc. TCP error code 10061: No connection could be made because the target machine actively refused it :32843.
w3wp.exe Visio Graphics Service Web Access High BeginGetVectorDiagram failed: System.OperationCanceledException: The server failed to process the request. ---> System.ServiceModel.EndpointNotFoundException: Could not connect to http://servername:32843/virtualDirectoryID/VisioGraphicsService.svc. TCP error code 10061: No connection could be made because the target machine actively refused it :32843. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it :32843


See Microsoft Technet Article for details about ports that need to be open for communication: http://technet.microsoft.com/en-us/library/cc262849.aspx#ServiceApp

You might find these articles useful