Tuesday, April 23, 2013

Fast Search in SharePoint 2010

Advantages of using Fast Search in SharePoint 2010
1. Crawl BDC content with FAST.
2. Previewers – Display inline previews of Word, PowerPoint, and Excel files.
3. Indexing more documents
4. FAST can be configured for Enterprise edition only
5. Search enhancements based on user context Scopes Best Bets, visual Best Bets, and document promotions and demotions to a sub-group of employees.
6. Rich Web indexing support Indexing of wide variety of Web content, including Flash.

Using LINQ to SharePoint

The LINQ to SharePoint provider is a new feature in SharePoint 2010 that allows you to use a strongly-typed entity model and the language integrated query (LINQ) query syntax to query list data. Essentially, LINQ to SharePoint hides the complexity of developing CAML queries from developers, which can reduce development time and make code more readable. The LINQ to SharePoint provider converts the LINQ expressions into CAML queries at run time.

Using LINQ to SharePoint in your own solutions consists of three main steps:
  • Generate the entity classes. Before you can start writing LINQ queries against your SharePoint lists, you must create or generate the strongly-typed entity classes that represent your list data and lookup column relationships.
  • Develop the solution. After you add the entity classes to your Visual Studio 2010 project, you can write LINQ queries against the strongly-typed entities that represent your data model.
  • Run the solution. At run time, the LINQ to SharePoint provider dynamically converts your LINQ expressions into CAML queries, executes the CAML, and then maps the returned items to your strongly-typed data entities.
Although you can manually develop your entity classes, in most cases, you will want to use the SPMetal command line tool. This is included in SharePoint Foundation 2010 and can be found in the BIN folder in the SharePoint root. The SPMetal tool targets an individual SharePoint site and, by default, generates the following code resources:
  • A data context class that derives from DataContext. This is the top-level entity class. It represents the content of your site and provides methods that allow you to retrieve list entities. The data context class uses the EntityList<TEntity> class to represent the lists in your site, where TEntity is a class that represents a content type.
  • Classes that represent content types. These are marked with the ContentTypeAttribute. Content type classes are generated for implicit content types as well as content types that are explicitly defined on the site. For example, if a user adds a column to an existing list, the user is creating an implicit content type and a representative class will be generated.
  • Classes and properties that represent relationships between listsSPMetal can detect relationships based on lookup columns. Within the entity class that represents a content type, SPMetaluses the EntityRef<TEntity> class to represent the singleton side of a one-to-many relationship and the EntitySet<TEntity> class to represent the “many” side of one-to-many or many-to-many relationships (known as a reverse lookup). Properties that are mapped to a field in a related list are decorated with the AssociationAttribute.

Error: The type or namespace name ‘SharePoint’ does not exist in the namespace ‘Microsoft’(are you missing reference?)

Issue: I’ve got the above error when trying to run a simple code in the console application. Though added the Microsoft.SharePoint .dll from the following path C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.dll, was getting the error during debugging.
Resolution: Right click the Solution Explorer and click properties, In Application tab, .Net Frameworkf 4.0 Client Profile was selected by default, change it to .Net Framework 3.5 and debug again. Also change the Platform target in the Build tab to x64.

When to use ‘using’ and ‘dispose’ and when not to use in SharePoint

If you create your own SPSite object, you can use the Dispose method to close the object. However, if you have a reference to a shared resource, such as when the object is provided by the GetContextSite method in a Web Part, do not use either method to close the object. Using either method on a shared resource causes an Access Violation error to occur
Likewise, If you obtain an SPWeb object using OpenWeb or RootWeb, the best practice is to implement the using statement or the Dispose method to dispose of the object.
However, if you have a reference to a shared resource, such as when you obtain the Web site object from the SPContext object in a Web Part by using SPContext.Current.Web, do not use either method to close the object.

SharePoint 2010 Development Platform Stack