Tuesday, December 11, 2012

Free Google Chart Sharepoint Web Part


Download here: http://www.amrein.com/apps/page.asp?Q=5749

The Google Chart Web Part allows to chart data contained in the specified SharePoint List. The charts are created using Google's public Chart API (see official Google Documentation)

The Web Part can be used with Windows SharePoint Services V3, MOSS 2007 and SharePoint 2010.

The Google Chart Web Part is the winner in the "Favorite Free SharePoint  web Part" category of the Andy Dale 2010 SharePoint Awards!



SharePoint Filtered Lookup Field

Download here: http://filteredlookup.codeplex.com/

This project creates a custom SharePoint lookup field that offers new functionalities to default SharePoint lookup field by allowing filters to be applied to retrieved data. Applied filters can be either dynamic CAML queries or pre-defined list views residing in source lists

Below is a few of the features offered by Filtered Lookup field over standard SharePoint Lookup field:
  • Cross-site lookup (all sites within same site collection)
  • Filter retrieved data using list views
  • Filter retrieved data using dynamic/ad-hoc CAML queries. This means you don't need to create a list view each time you want to apply a lookup filter to source data
  • Supports retrieving data recursively using either list views or dynamic queries
  • Supports MultiLookup with filtered data
  • Same look and feel as default SharePoint Lookup and MultiLookup (i.e. in list forms)































SharePoint Designer Workflow String Actions

Download here: http://spdwfstringactions.codeplex.com/

The source code is maintained in a Visual Studio 2008 environment, with WSPBuilder Version 0.9.9.0728.

After adding the WSP to your SharePoint environment, and deploying it, a Web Application feature will appear that must be activated on any web app on which users customise SharePoint Designer Workflows. If the feature isn't activated, users who open the SharePoint Designer Workflows UI will encounter an error when loading the SharePoint Designer Workflow UI. The error can be ignored, however none of these custom Workflow Actions will be available as a result.

After the feature is activated, you will see a bunch of new Workflow Actions in SharePoint Designer. Find them in the Workflow Designer by selecting the "Actions" drop-down button, choose "More Actions..." then choose "String Actions" from the "Select a Category" drop-down.

The following String Actions are included in this release:

Sunday, December 9, 2012

SharePoint 2013/2010 - Add PDF icon to the images library

Step 1: Open Image Folder at the SharePoint Server

c:\Program Files\Common Files\Microsoft Shared\web server extensions\<port>\TEMPLATE\IMAGES
<port>: e.g. 12

Step 2: Copy the following image to the folder:

(.gif for SharePoint 2010) (.png for SharePoint 2013)


Step 3: After you copy the picture file you need navigate to
“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML”

Step 4: And edit the DocIcon.xml with notepad and add the line
<Mapping Key=”pdf” Value=”icpdf.gif”/>

Once this is edited and saved (I would also recommend doing a backup of the file before you save it) you will need to do an IISreset before the icon will display.

How to copy the Document Library Properties to the Custom List for SharePoint using Workflow - copy the document Type (icon) and URL

Step 1: Create a Document Library:

Document Library A

Step 2: Create a new Column at the Document Library A as follows:

Read Only Permission (People) - provide the read only permission to the document.

Step 3: Create a Custom list which have the same Column Name & Settings as the Document Library A.

Custom List A

Step 4: Create a new Column in the Custom List A:

File (Hyperlink or Picture) - Format URL as Picture
Document URL (Hyperlink) - provide document URL from Document Library A

Step 5: Create a SharePoint Designer Workflow to run when a new documents added to the Document Library A.

Step 6: On the same Workflow, add a Impersonation Step and a code to to set the read only permission for the document base on Read Only Permission Column.

Step 7: On the same Workflow, added a code to copy the properties (Create New List Item) of the Document Library to the Custom List.

Step 8: On the same Workflow, added a code to copy the URL of the document to the Custom List A.




















Step 9: On the same Workflow, add a new Workflow Local Variables:

Typeoffile (string) - to temp store the icon URL

Step 10: On the same Workflow, added a code to copy the Type (icon linked to document) with the Code A to the Typeoffile (string). Then, add a code to update the item at Custom List A.

Code A: /_layouts/images/ic[%Current Item:Type%].gif















Step 11: Test the workflow by adding a new document to the Document Library A. The workflow will run and do the following actions:
  1. Change the Document Permission based on Read Only Permission (People) Column.
  2. Copy the Document Properties to the Custom List. Then set the Document URL value and Type of File (Picture) value in custom list based on Document Library A.

How to validate the special character on SharePoint List Column

Step 1: Open Column Settings for which column you want to add the validations:

List Settings > Change Column > Column Validation (below Column Settings) 

Step 2: Add the following code at the Column Validation:

=AND(IF(ISERROR(FIND(",",[ColumnName])),TRUE),IF(ISERROR(FIND("&",[ColumnName])),TRUE),IF(ISERROR(FIND("!",[ColumnName])),TRUE),IF(ISERROR(FIND("@",[ColumnName])),TRUE),IF(ISERROR(FIND("~",[ColumnName])),TRUE),IF(ISERROR(FIND("#",[ColumnName])),TRUE),IF(ISERROR(FIND("$",[ColumnName])),TRUE),IF(ISERROR(FIND("%",[ColumnName])),TRUE),IF(ISERROR(FIND("*",[ColumnName])),TRUE),IF(ISERROR(FIND("(",[ColumnName])),TRUE),IF(ISERROR(FIND(")",[ColumnName])),TRUE),IF(ISERROR(FIND("-",[ColumnName])),TRUE),IF(ISERROR(FIND("+",[ColumnName])),TRUE),IF(ISERROR(FIND(":",[ColumnName])),TRUE),IF(ISERROR(FIND(";",[ColumnName])),TRUE),IF(ISERROR(FIND("[",[ColumnName])),TRUE),IF(ISERROR(FIND("]",[ColumnName])),TRUE),IF(ISERROR(FIND(".",[ColumnName])),TRUE),IF(ISERROR(FIND("/",[ColumnName])),TRUE),IF(ISERROR(FIND("\",[ColumnName])),TRUE))

Saturday, December 8, 2012

Getting XML Data From a SharePoint List using OWSSVR.DLL

Reference 1: http://blogs.msdn.com/b/kaevans/
Reference 2: http://www.synergyonline.com/Blog/Lists/Posts/Post.aspx?ID=123

Ever since v1 of SharePoint Team Services, Microsoft has used OWSSVR.DLL to remotely invoke functions against SharePoint.  With the incorporation of Web Services in v2, this need is partly deprecated and even more so in v3.  Nonetheless, OWSSVR.DLL is still around and still plays an important role with external applications such as SharePoint Designer.  It is part of FP-RPC (Front Page – Remote Procedure Call) but should not be confused with Front Page extensions.

Step 1: Find the GUID for a list, just go to the List Settings page for the list and copy it from the URL. (_layouts/listedit.aspx)



Step 2: Use the following link to query the xml data from OWSSVR.DLL:

http://{0}/_vti_bin/owssvr.dll?Cmd=Display&List={1}&XMLDATA=TRUE
OR
http://{0}/_vti_bin/owssvr.dll?Cmd=Display&List={1}&View={2}&XMLDATA=TRUE

{0} – The URL to your site.  This could be the root web or a child site.
{1} – The GUID for your list. (Step 1)
{2} – The View GUID for your list. 

Location of Ribbon XML & Action JS for Ribbon


Location of Ribbon XML file is :

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML

Action JS code for most of these ribbon elements you can find here:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.Ribbon.debug.js

Actions for rich text editor ribbon are stored here:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.UI.Rte.debug.js

SharePoint Designer 2010: Workflow Error - Unexpected error on server associating the workflow

Option 1: Add executionTimeout at web.config
Reference 1: http://www.manjuke.com/2011/05/fixed-sharepoint-designer-error.html
Reference 2: http://social.msdn.microsoft.com/Forums/

Step 1: Open the ‘web.config’ which associate with the site collection that you are publishing the workflow:

C:\inetpub\wwwroot\wss\VirtualDirectories\xxxx\web.config
Note: xxxx is a Port Number.

Step 2: Find maxRequestLength and add executionTimeout as follows:

Before:   <httpRuntime maxRequestLength="51200" />
After:      <httpRuntime maxRequestLength="51200" executionTimeout="300" />

Step 3: Save the ‘web.config’ file and restart the web site from IIS. Then you can publish the workflow without any issue.


Option 2: Set new UserDefinedWorkflowMaximumComplexity at Windows Power Shell
Reference: http://support.microsoft.com/kb/2557533

By installing a CU that includes the server February 2011 CU, SharePoint administrators are now able to prevent compilation of workflows whose compilation would affect the performance of the farm. The default value of the property is 7000, but can be changed based on the needs and profile of the SharePoint farm.

The following PowerShell script can be used to adjust the value per SPWebApplication:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$new_limit = 5000;
$webapp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup(http://WebAppURL)
$webapp.UserDefinedWorkflowMaximumComplexity = $new_limit
$webapp.Update()

E.g.: Write-Host "Increasing Workflow parameter UserDefinedWorkflowMaximumComplexity..."

$app = get-spwebapplication http://SharePointWebSiteXXX
$app.UserDefinedWorkflowMaximumComplexity = 10000
$app.Update()


To give context to the default 7,000 value a Start Approval Process action contains 1176 nodes, a Start Feedback Process action contains 1010 and an empty Start Custom Task Process contains 13 nodes.

Please note, up to certain number, roughly 10000, the compliation will be restricted by Microsoft .NET 3.0 workflow complier so the workflow size still has a ceiling. At that point, the larger workflows need to be restructured to either have more reusable pieces, or be broken out into smaller individual small workflows.

Trick to Customize/Hide the default CSS Styles in Page for SharePoint

1st Option:

Reference: http://www.dhirendrayadav.com/2011/08/sharepoint-2010-tips-and-tricks-with.html

1. Click Edit the Page on the page where you need to apply the styles.
2. Add a “Content Editor" web part on the page and make it hidden.
3. Add the following code to the content editor web part (Edit HTML) where necessary.

01<style>
02/*--------Hide the columns--------*/
03.ms-viewheadertr {
04    displaynone;
05}
06/*---------Hide the Add Document option-------*/
07.ms-addnew {
08    displaynone;
09}
10/*---------Remove the new image icon on newly added documents-------*/
11IMG.ms-newgif {
12    display:none;
13}
14/*---------Hide the web part selection checkbox------*/
15.ms-WPHeaderTdSelection
16{
17displaynone;
18}
19</style>

Note: If you want to set this settings for a whole sites, you should set this settings at your site CSS file.

2nd Option:

1. Open Windows Power Shell (SharePoint Server)
2. Add this command:
stsadm -o setproperty -pn days-to-show-new-icon -pv 42