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: 

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

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()