Saturday, November 5, 2011

SharePoint BLOB Caching to increase performance

BLOB caching, or disk-based caching, is an out of the box (OOTB) caching mechanism that is built into the MOSS 2007 and SharePoint Server 2010 platforms. It is commonly used to speed-up access to large and relatively static resources that are stored in content databases, such as images, videos, javascript files, and more. Performance improvements are gained by storing these assets on web front-ends (WFEs) once they’ve been requested by a client. This allows SharePoint to serve subsequent requests for such assets directly from WFEs instead of round-tripping to the content database each time a request for such an asset is received. For most SharePoint sites, this type of caching can significantly lighten the load on your SQL Servers and back-end network.

BLOB Caching is controlled through the web.config file for each of the IIS web sites that is associated with a Web application, and it is not enabled by default. Enabling BLOB caching is as simple as setting the enabled attribute to true in the web.config element as shown below.

  BlobCache location=C:\blobCache” path=”\.(gif|jpg|png|css|js)$” maxSize=”10” enabled=true/>

Sunday, October 23, 2011

Find info about Farm Configurations

You can use the Get-SPFarmConfig cmdlet to retrieve global settings for the local farm. The cmdlet returns information for items that are not on the SPFarm Object.
PS > Get-SPFarmConfig
WorkflowBatchSize                                        : 100
WorkflowPostponeThreshold                     : 15
WorkflowEventDeliveryTimeout              : 5
DataFormWebPartAutoRefreshEnabled : True
ASPScriptOptimizationEnabled               : True

Tuesday, October 11, 2011

You Cannot Use SharePoint Foundation 2010 Objects with .NET 4

The SharePoint Foundation 2010 object model is not accessible using the .NET Framework 4 (or later).  Calling any object or method in the object model using any framework version other than .NET 3.5 will throw the following exception: 

System.PlatformNotSupportedException
Microsoft SharePoint is not supported with version 4.0.30319.1 of the Microsoft .Net Runtime.


Of course, you can always access the SharePoint objects using the web services interface from your .NET 4 application, but this will only allow limited functionality of the complete object model.

Embedding a YouTube Video

To embed YouTube videos on your SharePoint site, get the ‘embed video code’ from the YouTube site and copy paste into a notepad.  Upload the notepad to a library. 
Add a content editor web part and point the content link to this notepad.  This will embed the video on the SharePoint page and can be played via the SharePoint media player.

Saturday, October 8, 2011

Using "Send To" to Route Documents

Documents are not always created in the location where they should finally be routed to.  For example, documents may be created in one site but routed to a different site for final review by clients or customers. 

This can be easily achieved in SharePoint 2010 via simple short cut menus that can be set up for a document library. This is done by enabling the content organizer features and configuring ‘send to’ connections from central administration.  This connection will then appear for all documents in a document library for the configured site.  Easily write content organization rules for the drop library to route the document to its final destination.

Thursday, October 6, 2011

Sync Users Information from Active Directory

You can sync User information from the User Directory Store. Simply, use the Set-SPUser cmdlet and use the SyncFromAD switch parameter to enable syncing. 
PS > Set-SPUser -Identity powershell\username
>> -Web http://sp01 -SyncFromAD

Monday, October 3, 2011

Adding Text Fields to a List

You can use Windows PowerShell to add Text fields to a List in SharePoint 2010. Simply use the Add() method available on a fieldcollection. The example below demonstrates how to add a Text field to the Tasks list, set a Description and set the field as required. Note that the Add() method allows us to specify the Fields Name, the Type of Field and a Boolean value that determines if the field should be required.

PS > $spWeb = Get-SPWeb http://SP01.powershell.nu

PS > $spList = $spWeb.Lists["Tasks"]
PS > $spList.Fields.Add("Text Field","Text",$true)
PS > $spList.Fields[“Text Field”].Description =My Custom Text Field
PS > $spList.Fields[“Text Field”].Update()
PS > $spWeb.Dispose()

Friday, September 30, 2011

Install PDF Filter Using PowerShell

SharePoint 2010 doesn’t support PDF files by default. You can solve this by installing Adobe PDF iFilter 9 for 64-bit platforms and following the steps described below. First, you can download PDFFilter64installer.msi: http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025
You’ll also need an icon that will be used in SharePoint 2010 for PDF files:
http://www.mossgurus.com/adnan/Documents/pdf16.gif

Next, start PowerShell and run the following command to install the MSI Package and configure SharePoint 2010:

# Install MSI
PS > $iFilter =C:\Media\IFilter\PDFFilter64installer.msi”
PS > Start-Process -FilePath $IFIlter -ArgumentList "/quiet"Wait
# Copy Icon to SharePoint Folder
PS > $icon =C:\Media\IFilter\pdf16.gif”
PS > Copy-Item -Path $Icon -Destination "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES"
# Modify DocIcon.xml
PS > $path = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML\DOCICON.XML"
PS > $xml = New-Object XML
PS > $xml.Load($path)
PS > $element = $xml.CreateElement("Mapping")
PS > $element.SetAttribute("Key","pdf")
PS > $element.SetAttribute("Value","pdf16.gif")
PS > $xml.DocIcons.ByExtension.AppendChild($element) | Out-Null
PS > $xml.Save($path)
# Add PDF type to Search Service Application
PS > New-SPEnterpriseSearchCrawlExtension -Name "pdf" `
>> -SearchApplication SearchServiceApp
# Modify Registry
PS > mkdir 'HKLM:\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf'
PS > Get-Item 'HKLM:\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf' | >> Set-ItemProperty -Name "(default)" `
>> -Value "{E8978DA6-047F-4E3D-9C78-CDBE46041603}"
# Restart Search Service
Get-Service | Where-Object { $_.Name -eq "OSearch14" } |
>> Restart-Service

Tuesday, September 27, 2011

KPI Values in SharePoint 2010

Previous versions of SharePoint had limitations to folders support for the KPI Lists. Whenever you tried to set Folder as a source of your KPI, SharePoint gave you an error that the folder can't be selected. To avoid such situation you had to maintain KPI values in different list or use Views.
The issue with Views is that they don't allow you to assign the permissions per View, so you can't have groups of data and assign different permission for KPI values based on views.
The only solution for SharePoint 2007 was usage of separate Lists. SharePoint 2010 fixed this issue, and now you can organize your values per folders in one List for KPI’s.

Sunday, September 25, 2011

PowerShell commands for SharePoint 2010

PowerShell commands for SharePoint 2010 To find the PowerShell commands n SharePoint 2010, try these:
>Get-Command -Noun SPSite
You can get the all PowerShell commands:
>Get-Help Get-SPSite
You can get the Name, Syntax, Description, Related Links, Remarks
To Retrieve content database for a specific site collection:
>Get-SPContentDatabase -Site http://SPServer01
Results:
ID:96dfa345-43df-3edg-bbc6-1l4e8ee105le
Name:WSS_content
Web Application:SPWeb Application Name=Sharepoint - 80
Server:SPServer01
CurrentSiteCount
:2

To retrieve the content database for a specific Web Application:
>Get-SPContentDatabase -WebApplication "Sharepoint - 80"
Results:
ID:96dfa345-43df-3edg-bbc6-1l4e8ee105le
Name:WSS_content
Web Application:SPWeb Application Name=Sharepoint - 80
Server:SPServer01
CurrentSiteCount
:2
I hope this tip helps someone else save time and frustration as it did for me.