Chris’s SharePoint Reflections

Just another WordPress.com weblog




  • Chris Zhong

    IT consultant Australia








Error: “The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request”

Posted by chrissyz on March 25, 2012

Have you experienced “Error: “The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request”  when you try to activate your sandbox solution and  Microsoft SharePoint Foundation Sandboxed Code Service is running OK on your server? Well.. this is what happened to me today. Check below post http://blogs.msdn.com/b/sharepointdev/archive/2011/02/08/error-the-sandboxed-code-execution-request-was-refused-because-the-sandboxed-code-host-service-was-too-busy-to-handle-the-request.aspx.  This is actually caused by incorrect registry key and  below is the workaround that works for me:

1.    On the server, click Start | Administrative Tools | Services.

2.    On the Services dialog, scroll to SharePoint 2010 User Code Host.

3.    Note the full user name in the Log On As column. You will need this information later.

4.  Open SharePoint Management Shell.

5.  Enter the following at the command prompt, including all punctuation.

(Get-SPManagedAccount –Identity “username”).Sid.Value

Replace username with the name you obtained in step 3. E.g., CorpDomain\FarmAdmin

This will return the user’s SID (Security ID), which you will use in a later step.

6.    Open the registry editor and navigate to:

HKEY_USERS\SID you obtained earlier\SOFTWARE\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\SoftwarePublishing

7.     Be sure the State key value is set to 0x00023e00.

8.    Restart the sandboxed host service on all servers on which it is to run. It cannot hurt to do an iisreset as well.

Posted in General, Trouble Shooting | Tagged: | Leave a Comment »

Tips for SharePoint 2010 developers

Posted by chrissyz on June 25, 2011

Have you been developing SharePoint 2010 solutions? Here are a couple of tips I would like to share with you.

1. Integrate SPDisposal Checker into your Visual Studio development project

If you have been following my previous blog on disposing SPSite and SPWeb, you should already been familiar with the SPDisposal checker tool. To increase the development efficiency and team collaboration, I normally integrate the output into VS project so I can see the results everytime I build the assembilies. This is very useful on the team project to increase the code quality. The latest version has a Visual Stuido AddIn Option, which integrate the tool into your Visual Studio automatically and output the findings as Error/Warning. Highly recommend!

SPDisposal Checker for Visual Studio

2. SharePoint 2010 Developer Dashbroad

This tool is really good with troubleshooting. It gives us metrics and allows us to trace page load activities. I usually set it ondemand using stsadm command. Of course you can use Powershell as well. I know I am a bit old fashioned.🙂

After then you should see a nice toggle button on the top right corner of the page. If  not, make sure you have the right permission to the site.

Posted in development, SharePoint 2010 | Tagged: , | Leave a Comment »

SharePoint 2010 Document Management features

Posted by chrissyz on February 17, 2011

Today I would like to talk about a couple of lovely new features in SharePoint 2010 Document Management. Before my ranting starts, I think probably clarify some terminologies first as they can be confusing sometimes (but necessarily have to :)). SharePoint Document management is a subsite Enterprise content management (ECM) workload (remember the classic six wheel?) ECM refers to technologies, methods and tools used to capture, manage, store, preserve and deliver content and documents related to an organization and its processes.

A similar but often confused term is web content management. This technology addresses the content creation, review, approval and publishing processes of web-based content. Key features include creation and authoring of tools or integrations, input and presentation template design and a subset of ECM.

And what about document management?  DM helps organization better manage the creation, revision, approval and consumption of electronic documents. It provides key features such sass document profiling, checking/check out, version control, security etc.

DM is similar to ECM, but the same. Both of them facilitate information life cycle management, encourage collaboration and help manage information. But the key differences are: ECM can manage more than just documents. It brings a large science of record management and manage rich media and even hard copies. DM is purely the management of the documents, with or without any records management

This brings us another term: Record management. Record management is the practice of maintaining the records of an organization from the time they are created up to their eventual disposal. Duties may include classifying, storing, securing and destroying the records.

OK. Now we are all clear. In this post I will cover some DM features that I personally think is very useful. A bit of history, SharePoint 2007 was the first release where SharePoint really broke out of its collaboration role and enabled customers to apply structure and management to their document libraries. A lot of the key DM infrastructure was established in that release: Check in/Check Out, Major/Minor Versioning, Per-Item Permissions, Content Types, Workflows, and the Recycle Bin are just a few examples. In  the SharePoint 2010 version, the team keep up the good work and bring to us some freshness into this space.

  • Document ID

In a heavily used and adopted collaboration environment, one challenge people face is when content is reorganised or moved in the typical course of business. Hyperlinks emailed between team members that point to a document are no longer relevant which causes frustration and loss of efficiency. SharePoint 2010 offers a new capability to assign documents a unique identification number. This unique ID, embedded within a special URL, can then be used to retrieve the document regardless of where it is moved to within the site collection. No more broken links!

  • Document Set    

People often create multiple documents that support a single project or task. SharePoint 2010 includes a feature that enables people to group all of these documents together into a single entity. All documents in a Document Set share the same metadata and the entire Document Set can be versioned as a whole and downloaded as a compressed ZIP file with all contents included. People can also initiate a workflow on the entire Document Set instead of individual workflows for each document.

  • SharePoint Workspace 

Two highlights regarding SharePoint Workspace. The first one is offline capability. Whether you are travelling on an airplane or just have spotty network access, SharePoint workspace allows you to take your content offline. The other one is its rich experience. From drag-and-drop functionality to better performance, SharePoint workspace provides all the benefits to a rich client. And since it is a rich client, it also provides quick and easy navigation among list and libraries. You can simply click from one to another without waiting for webpages to load. The caveat when you are using SharePoint workspaces is you cannot download all content types with it. For example, you cannot download from a calendar, wiki and survey

Posted in General, SharePoint 2010 | Tagged: , | Leave a Comment »

Leverage Search Crawl rules and Content Class property to refine SharePoint Search result

Posted by chrissyz on April 18, 2010

OOTB SharePoint search is quite powerful. The search engine of MOSS 2007 has only one physical index for each SSP in the farm. This implies that the content from all the content sources defined for the SSP is crawled into the same index. This provide the user’s ability to search across all the content using one query. But  in many search scenario, it also calls for mechanisms to automatically narrow user queries to a logical group of content within the physical index. I will introduce two methods here today to achieve that.

Use Search Crawl rules

Search Crawl rules are mechanism to influencing the behaviour of the crawler when it crawls specific sites. A single crawl rule is created by specifying a URL wildcard matching sites plus a set of options for setting the behaviour of the crawler for these sites


 For example: if you like all the document views and properties page to be excluded, you can use achieve it by configuring the crawl rule:

1. Go to the crawl rules section of the search setting in the SSP

2. Add crawls rules to exclude the following path:

*://*webflder.aspx*

*://*allitems.aspx*

*://*dispform.aspx*

You can also test a specific URL against the crawl rules to determine whether the rules will include or exclude the URL during a crawl. This feature is not available in SharePoint Server 2003.

In SharePoint 2007, wildcard operator “*” is the only operator supported in crawl rules foe matching everything. Because of its  nature that matches everything, it does not have the flexibility to, for example, recognize and omit URL that contain mobile phone number.

SharePoint 2010 includes new capability in this area to support regular expression in the URL

Check Microsoft Enterprise Search blog for more details

Use Content Class in scope

Most of you already know how to use sharepoint custom scope to fine tune your search result. For those who don’t know, there are plenty materials on the internet.:) I only want to get your attention on one of the managed property, contentclass. Essentially, every piece of SharePoint content seems to be tagged with this property. And as long as you know the internal name and its corresponding mapping, you should be able to configure your sharepoint search scope quite efficiently. For example, if you want to return all the documents and pages, you can set up the scope like this:

Below is a list of content class and its mappings prepared by Dan Attis in his blog. Should give you enough information to get started.

        case “STS_Web”:                             // Site
        case “STS_List_850”:                        // Page Library
        case “STS_ListItem_850”:                    // Page
        case “STS_List_DocumentLibrary”:            // Document Library
        case “STS_ListItem_DocumentLibrary”:        // Document Library Items
        case “STS_List”:                            // Custom List
        case “STS_ListItem”:                        // Custom List Item
        case “STS_List_Links”:                      // Links List
        case “STS_ListItem_Links”:                  // Links List Item
        case “STS_List_Tasks”:                      // Tasks List
        case “STS_ListItem_Tasks”:                  // Tasks List Item
        case “STS_List_Events”:                     // Events List
        case “STS_ListItem_Events”:                 // Events List Item
        case “STS_List_Announcements”:              // Announcements List 
        case “STS_List_Contacts”:                   // Contacts List
        case “STS_ListItem_Contacts”:               // Contacts List Item
        case “STS_List_DiscussionBoard”:            // Discussion List
        case “STS_ListItem_DiscussionBoard”:        // Discussion List Item
        case “STS_List_IssueTracking”:              // Issue Tracking List
        case “STS_ListItem_IssueTracking”:          // Issue Tracking List Item
        case “STS_List_GanttTasks”:                 // Project Tasks List
        case “STS_ListItem_GanttTasks”:             // Project Tasks List Item
        case “STS_List_Survey”:                     // Survey List
        case “STS_ListItem_Survey”:                 // Survey List Item
        case “STS_List_PictureLibrary”:             // Picture Library
        case “STS_ListItem_PictureLibrary”:         // Picture Library Item
        case “STS_List_WebPageLibrary”:             // Web Page Library
        case “STS_ListItem_WebPageLibrary”:         // Web Page Library Item
        case “STS_List_XMLForm”:                    // Form Library
        case “STS_ListItem_XMLForm”:                // Form Library Item
        case “urn:content-class:SPSSearchQuery”:    // Search Query
        case “urn:content-class:SPSListing:News”:   // News Listing
        case “urn:content-class:SPSPeople”:         // People
        case “urn:content-classes:SPSCategory”:     // Category
        case “urn:content-classes:SPSListing”:      // Listing
        case “urn:content-classes:SPSPersonListing”:// Person Listing
        case “urn:content-classes:SPSTextListing”:  // Text Listing
        case “urn:content-classes:SPSSiteListing”:  // Site Listing
        case “urn:content-classes:SPSSiteRegistry”: // Site Registry Listing

Posted in Search | Tagged: , , | 2 Comments »

Dispose SPWeb/SPSite in MOSS/WSS

Posted by chrissyz on January 16, 2010

Why we need to dispose them?
In SharePoint, each SPWeb and SPSite object holds a reference to an SPRequest object which holds reference to a SharePoint COM object. In order to ensure that the SPRequest object will release the COM object as well as all the memory allocated by this COM object, it is necessary to dispose the unmanaged resources in a timely fashion. Though internally, .NET framework has a finalizer to release the native memory, however, as it runs on a single thread, it generally cannot keep up with cleaning these objects if they are being leaked many times in a second.
The consequence of not explicitly disposing unmanaged resources in a timely fashion can lead to not having enough memory and quickly consume memory. Furthermore, as each COM object is responsible to communicate with the backend SQL Server, in case the SPWeb object is not disposed when it is no longer used, then the connection to the SQL Server will stay open. Each connection to the database requires a TCP port for the communication. By default, only 5000-1023=3977 ports are available ( MaxUserPort Registry), which means on a single machine per default you cannot have more than 3977 open connections to other applications. So, besides the fact that not disposing SPWeb and SPSite will lead to higher memory consumption which finally can lead to out of the memory exceptions, the machine might also run out of TCP ports.

Symptoms/Issues which users can experience when the unmanaged objects are not disposed correctly
1. Database Connectivity
When object are not disposed correctly, you can find a lot of the following database related error messages in your SharePoint WFE event log and ULS log.
When all the TCP ports are in use, this will result in the following error message/event logs
• Event ID 3355 errors: Cannot connect to SQL Server. XXX not found. Additional error information from SQL Server is included below. [DBNETLIB][ConnectionOpen(Connection())]SQL Server does not exist or access denied.
• Event ID 27745 errors: Unable to connect to the database XXX. Check the database connection and make sure that the database server is running
• The ULS log shows the same database related error as above

2. ULS Logs errors
The ULS log will show errors when objects are not disposed correctly. The database related ULS log errors are already written down in the previous section. This section will focus on the SPDispose related error message in the ULS logs (by default located in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS). The error message will be like this

1/14/2010 14:15:48.91 w3wp.exe (0x145C) 0x04AC Windows SharePoint Services General 8l1n High An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it. This object will now be disposed. Allocation Id: {951F9932-6C3F-4FC9-AFA8-824892FA8142} To determine where this object was allocated, create a registry key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\HeapSettings. Then create a new DWORD named SPRequestStackTrace with the value 1 under this key

Best Practices:
1. Practice the best coding practice regarding dispose the SPWeb/SPSite. Some good resources can be found on the internet.

http://blogs.msdn.com/rogerla/archive/2008/10/04/updated-spsite-rootweb-dispose-guidance.aspx
http://msdn.microsoft.com/en-us/library/aa973248.aspx

http://solutionizing.net/2009/01/09/splist-parentweb-leaks-revisited/
http://furuknap.blogspot.com/2009/07/splistrootfolder-causes-dispose-problem.html
http://msdn.microsoft.com/en-us/library/bb687949.aspx

http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx

2. SPDispose Checker Tool
On MSDN a tool is available which can check your developed assemblies. This tool will check most of the common dispose issues, but will not check all issues that can occur related to disposal of SharePoint objects. So you should fix at least all issues which are found after running the SPDispose Checker and then continue applying the best coding practices

3. Be aware of the out-of –the-box memory hungry component
Be aware of some of the OOTB components can require huge amount of memory when incorrectly configured. Navigation control is a good example. For each item in a navigation control that has to be retrieved through the sharepoint site map provider SPWeb and SPSite will have to be created. Though the control itself ensure that those objects are disposed correctly before the request ends there are often several of these objects in parallel in memory while the control is being rendered.
4. Switching to 64-bit architecture
In 64-bit architecture, the virtual address space is no longer limited to 2GB. This also means that memory fragmentation will not have the negative effects as in 32-bit architecture. However, even in 64-bit architecture, you still have the same limitation regarding TCP ports.

Posted in development, Performance | 1 Comment »

SharePoint DateTime Control

Posted by chrissyz on July 9, 2009

SharePoint brings its own controls and DateTime control is one of them. You can definitely leverage it in your web parts and custom aspx pages. The control is located in the Microsoft.SharePoint.WebControls namespaces.

How to define it? First you need to add the following directive at the top of your application page:

<%@ Register TagPrefix=”SharePoint” Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>

And then place the control in your page

<SharePoint:DateTimeControl runat=”server ID=”dtcDateTime”/>

Please notes that above is just a basic definition, for detailed properties, please check out this link:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.datetimecontrol_members.aspx

How to validate it?

<SharePoint:DateTimeControl runat=”server ID=”dtcDateTime”/>

<asp:CompareValidator ID=”valDateTime” runat=”server”

ForeColor=”Red”
ControlToValidate=”dtcDateTime$dtcDateTimeDate”
Type=”Date”
Operator=”DataTypeCheck”
ErrorMessage=”please enter a valid date” />

How to set a default value to it?
dtcDateTime.SelectedDate = new DateTime();
Check this link for the overloads:
http://msdn.microsoft.com/en-us/library/system.datetime.datetime.aspx

Important notice:

There is a Microsoft bug in SharePoint DateTime Control.
This DateTimeControl loses state during postbacks, specifically of the hour.
I struggled a bit to get this work around because it doesn’t work even if I put enableviewstate=”true” in the control.
However I happened to get this work by adding this line of code in a event that caused the postback. It could be any method/Event, in my case, it is SelectedIndexChanged event:
if (dtcDateTime< DateTime.Today)
{
//Don’t do anything
}
Just be doing this, it maintains the value of the control during postback.

Posted in development | Tagged: | 9 Comments »

Customization of SharePoint list menu item – Part 1 add Custom Action Item

Posted by chrissyz on June 6, 2009

It has been a while since last time I blogged. And I do feel bad about being ignorant of my blog for such a long time. So this time I am gonna show some code to feed those hungry souls. Today I would like to talk about adding a list menu item through feature. This example is to add a menu item in a calendar list.

We all know a feature includes two files, feature.xml and elements.xml

In our feature.xml, nothing special, it will look like any other normal
feature.xml

<?xml version=1.0encoding=utf-8?>

<Feature  Id=GUID”
          Title=Calender list Menu
          Description=Creates Custom Action in Calender list item menu”
          Version=12.0.0.0″
          Hidden=TRUE”
          Scope=Site                                                                
          xmlns=http://schemas.microsoft.com/sharepoint/>

<
ElementManifests>

<ElementManifest Location=elements.xml/>

</ElementManifests>

</Feature>

Then comes the elements.xml

<?xml version=1.0encoding=utf-8?>

<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<CustomAction  
    Id=F699684E-3127-428e-BF2B-EA71CA6E36C8   
    RegistrationType=List   
    RegistrationId=106  
    Location=EditControlBlock  
    Sequence=1000  
    Title=Calendar Custom Action>
    <
UrlAction
Url=~site/YourPageLibrary/YourCustomPage.aspx?ID={ItemId}&amp;List={ListId}/>
  </
CustomAction>

</Elements>

RegistrationType can be “ContentType”, “FileType” (for example if you only want your feature appear to .xsn file), list and Prog ID.

The RegistrationID element is used to specifiy the ID of RegistrationType. If RegistrationType is “ContentType”, to get Registration ID, open the document library settings, in the ContentType section click on the content type you
choose, then grab the hex string in the url after “ctype=” parameter.

If you use FileType as RegistrationType, then just add the “.doc” or “.xls” etc in the RegistrationID

If the RegistrationType is list or ProgID, John Holiday has a blog summarized all the RegistrationID, look it up!

Adding a CustomAction menu item is not that difficult, however, it is a bit tricky to hide/remove it. I will talk abou it in my next post – Customization ofSharePoint List Menu Item – Part 2 Hide Custom Action Item

Posted in development | Tagged: , | 1 Comment »

How do I trouble shooting- Parser Error Message: Unrecognized attribute ‘type’

Posted by chrissyz on May 5, 2009

Well, this is annoying… after some developers on my team played around ASP.NET framework (this is what I am guessing.. no one come to me to confess so far though :)) our SharePoint portal suddenly stop working and get this message

 

 

Server Error in ‘/’ Application.

Configuration Error

 

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

 

Line 14:       <section name="BlobCache" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Line 15:     </sectionGroup>
Line 16:     <sectionGroup name="System.Workflow.ComponentModel.WorkflowCompiler" type="System.Workflow.ComponentModel.Compiler.WorkflowCompilerConfigurationSectionGroup, System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
Line 17:       <section name="authorizedTypes" type="System.Workflow.ComponentModel.Compiler.AuthorizedTypesSectionHandler, System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
Line 18:     </sectionGroup>

 

 

Unrecognized attribute ‘type’.
Source Error:

 

 


Source File: C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config    Line: 16
 



Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407

It took me some efforts to resolve this issue…

First of all, after some investigation, I found in IIS manager, our sharepoint site is pointing to ASP.NET framework 1.1. The fix will be adjust it back to ASP.NET framework 2.0 (Just right click the web site -> Properties->ASP.NET tab ->Choose the correct framework)

Now I re-render it again. This time I got page cannot be found error…Argh….so I tried re-registering ASP using Aspnet_regiis.http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx

And then render the page again…now I got this error:

CS0016: Could not write to output file ‘c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a0f950ac\3f897461\fr-fr\App_GlobalResources.k8ft-2zy.resources.dll’ — ‘The directory name is invalid. ‘

OK, babe…whatever..This clearly indicate that the folder Temporary ASP.NET Files does not exist. So I went to My computer ->Properties->Advanced->Envrionment Variables. Make sure the folder System variables TEMP and TMP is pointing to exists on your computer and Network Services and aspnet accounts have full control of it.

Then after an iisrest and long wait, my dream portal finally appears on the screen!

 

 

Posted in development | Tagged: | 7 Comments »

The cornerstones of SharePoint information Architecture- Site Column and Content Types

Posted by chrissyz on April 16, 2009

Site columns and content types are the foundation of information architecture planning in SharePoint. It is always best practice to invest your time in the upfront planning site columns and content types when setting up your site collections. Trust me. It will all pay off during the management and maintenance phase for your SharePoint implementation. J

First, let’s review the concepts of site column and content type

Site columns can be thought of as templates; SharePoint offers the ability to create customized site columns when the default document library columns and the Core Document Columns are not enough. The column we created here scoped at the site collection level in the site column gallery. Once it is created, you can use it in any list or library to make the information searchable and manageable through metadata.

Another important point to mention: when you add a site column to a list, the resulting list column has the same field ID as the site column. SharePoint uses this to track which list columns are “children” of a given site column. This enables you to make changes to a site column and propagate those changes out to all the list columns that are children of the site column.

 

A Content Type is a reusable grouping of site columns that can be utilized by a list or library. This makes it possible to maintain a consistent metadata structure for all documents or items of that type in a Site Collection. A Content Type can carry a workflow, an Information Management Policy and a document template along with the site columns. Whenever the Content Type is associated with a library or list, all of the functionality built into the customization of that Content Type will be available to that library or list. However, you cannot create a column in a content type; rather, you have to create the column, and then reference that column in the content type definition. Because of this, when you add a column to a content type, the content type schema doesn’t contain a <Field> element, it contains a <FieldRef> element

 

Using a single Content Type in multiple lists allows for consistency in the data structure. The consistency adds to the ability to find those list items through a search across the metadata. Another added benefit of using a Content Type in multiple locations is maintainability. Any changes to the parent Content Type can be passed down to any list that is using that Content Type.

We can either create site columns and content types in a browser or through features. We recommended using the later one just because it is easy to transfer between environments,  develop – test – staging- production, this is especially important in the enterprise application space.And it is not complex. You can reference this article to create site column and content type through features. But there are a couple of gotchas for feature deployment.  First of all, at times, the changes to the site column are not reflected when the Feature is reactivated, even when using the optional -force switch to force all updates. It appears that, even though the Feature was deactivated and the site column was removed from the site, SharePoint has left an orphaned site column in the system, and future changes will not take effect, even though it does not appear anywhere on the site.

The workaround is adding the attribute DisplaceOnUpgrade=TRUE to the <Field> node. This way, SharePoint will update the existing site column the next time it is activated.

Another one is once a feature containing content types is activated, developers can update the Feature and reactivate it to make changes to the created content type. However, changes are not pushed down to other content types that inherit from the one being inherited, nor are the changes pushed onto lists where the content type has been added. The only content types updated are those that are not in use.The workaround will be using SharePoint object model. It provides a method for updating content types, and forcing updates to cascade to other child content types and lists that contain the content types.

Posted in Information Architecture | Tagged: | 1 Comment »

Managed Property in SharePoint Search

Posted by chrissyz on February 17, 2009

Managed Property plays a very important role in MOSS 2007 Search. If used properly, you can greatly enrich the user search experience without spending a lot of effort. Before we go in the topic, let’s look at what is managed property.

The SharePoint search engine index both unstructured information, like text in word documents, http pages ectc and structured information (metadata), such as file size, file extension, title, author etc. We call this piece of metadataproperty. SharePoint operates with two kinds of properties: crawled property and managed property. Crawled properties are discovered by the crawler. Each SSP has a list of crawled properties in the metadata store in its SQL database. Properties are automatically added into the metadata store when the crawler crawling content. Thus, the number of crawled properties can be added up quickly. This crawled property list is shared across all content sources in SSP.

 Before MOSS 2007, SharePoint only operates with Crawled property. However, in reality, only a small subset of the crawled property is needed for searching and for displaying the search results. And you don’t have control of the name of the crawled properties. Crawler will name them itself by some internal naming rules. Thus, they can have lengthy names that would make them hard to reference in code or other places.

Managed property is a new concept introduced in MOSS 2007. They are created by SSP administrators and provide an easier and more consistent experience for managing and using the subset of crawled properties that matters to the business. And you can also map several crawled properties to the same managed property. This makes it possible to join different crawled properties that are semantically the same to a single managed property.

 Here are some examples of managed properties that are available in MOSS 2007,

  • AssignedTo
  • Author
  • ContentType
  • FileExtension
  • SiteTitle
  • etc..

Check the blog to see how you can create your own managed property. 

The use cases for managed properties:

  • Construct Search Query : The most straight forward way is to execute searches from the search box using managed properties. We can enter them directly into the search box. For example, I want to find all the documents written by me, I would execute a search in my MOSS site using the following text:”Author:Chris”
  • Customize Search Results: We are all familiar with OOTB search results that displaying the metadata, like title, author, URL etc. Actually, we can customized the search results to display any available metadata as long as the metadata is a managed property in the index
  • Expose for advanced search: The Advanced search page has property picker that can be populated managed properties. You can add managed properties to the property picker in the advanced search page by modifying the XML attaché to the Advanced Search Box for the properties. Here is a MSDN Visual How-to shows you step by step how to do that. Check it out!
  • Use in Search scope: You can use managed property to configure search scope. Here is a good blog of how to do it. 
  •  Custom relevancy ranking: Managed properties play a role within the ranking of the results.The managedproperty class exposes the Weight property which can be changed programmatically to influence the relevance ranking

Posted in Search | Tagged: | 3 Comments »