SharePoint integration



You can use ColdFusion with Microsoft Windows SharePoint Services 2.0 or 3.0, and Microsoft Office SharePoint Portal Server 2003 or 2007. You can integrate ColdFusion applications with SharePoint features that are exposed as web service actions.

Load SharePoint actions from ColdFusion

Use the cfsharepoint tag to access exposed SharePoint features, without loading the web services directly. The cfsharepoint tag works only if the SharePoint server uses basic authentication. By default, ColdFusion supports a subset of features that are exposed as web services in SharePoint. If a web service is not supported in ColdFusion, specify the URL to the WSDL (Web Services Description Language) of the web service that is loaded.

For information about the supported SharePoint features, see the CFML Reference.

Using cfsharepoint

Sharepoint integration with ColdFusion helps you dynamically manage user lists, views, and groups; work with images and document workspaces; and use search effectively. The cfsharepoint tag lets you create new lists, retrieve list items, and update list items on the SharePoint server.

The following example shows how to create a picture library list called "getpics".
<cfsharepoint 
    action="addlist" 
    login="#login#" 
    params="#{ listname ="getpics", 
    description="This a picture library list", 
    templateId= "109 " }#"/>  
 <! --- Creates a folder within the picture library list> 
< cfsharepoint 
    action  ="create new folder" 
    login= "#login#" 
    name="collection1" 
    params="#{strListName="getpics", 
    strParentFolder=""}#"/> 
<!--- Uploads pictures to the folder that you created ---> 
<cfscript> 
    myimage = filereadbinary(expandpath("Bird.jpg")); 
    //convert the image into byte array to pass as input for "upload" action. 
</cfscript> 
<cfsharepoint 
    action="upload" login="#login#" 
    params="#{strListName="testpics", 
    strfolder="Collection1", 
    bytes="#myimage#", 
    filename="bird.jpg", 
    fOverwriteifexist=true}#"/> 
 
<!--- Rotates the picture downloaded from the SharePoint server.---> 
<cfsharepoint 
    name ="result1" 
    action="download" 
    login="#login#" 
    params="#{strListName="getpics", 
    strfolder="New Folder", 
    itemFileNames=["bird.jpg"],type=1, 
    fFetchoriginalIfNotAvailable=true}#"/> 
<cfimage 
    action="rotate" 
    source="#result1.file#" 
    isbase64="yes" 
    angle="45" 
    name="temp" 
    destination="bird.jpg" 
    overwrite="yes"/> 
<cfscript> 
baseimage = filereadbinary(expandpath("bird.jpg")); 
//convert the image into byte array to pass as input for "upload" action. 
</cfscript> 
<!--- Uploads the rotated image back to the SharePoint server ---> 
<cfsharepoint 
action="upload" 
login="#login#" 
params="#{strListName="getpics",strfolder="Collection1", 
bytes="#baseimage#",filename="bird.jpg",fOverwriteifexist=true}#"/>

To check and ensure that all the updates are made, you can retrieve the list items using code like the following:

<cfsharepoint 
    action="getimaginglistitems" 
    login="#login#" name="result" 
    params="#{strListName="getpics",strFolder="#result3.title#"}#"/> 
<cfloop array="#result.Library#" index="n"> 
<cfif n.ows_FileLeafRef  contains "temppicrotate.jpg"> 
SUCCESS 
<cfbreak> 
</cfif> 
</cfloop>

Access ColdFusion from SharePoint using custom Web Parts

You can access ColdFusion applications from within SharePoint using custom Web Parts. You can create a custom Web Part using the Page Viewer Web Part template that is shipped, by default, with SharePoint services 2.0 and 3.0, and Microsoft Office SharePoint Portal Server 2003 or 2007.
  1. From the SharePoint Server page, click Modify Shared Page.

  2. Select Add Web Part.

  3. Click Browse from the pop-up menu. The Web Parts list appears.

  4. Select Page Viewer Web Part.

  5. Click Add. The Page Viewer Web Part loads.

  6. Click the Open the Tools Pane link.

  7. Specify the URL of the ColdFusion application in the URL text field. The ColdFusion application loads within the Web Part.

Note: In a Multiserver installation on the Macintosh platform, SharePoint does not work properly if the tools.jar file is present in WEB-INF/cfusion/lib. In this case, you see the following error message:"coldfusion.jsp.JavaCompiler’s UnknownCompiler: Unable to run the internal Java compiler: java.lang.NoClassDefFoundError: javax/tools/StandardJavaFileManager.” To overcome this issue, copy the tools.jar file to a backup directory and delete the tools.jar file from WEB-INF/cfusion/lib.

Use Single Sign-On to access ColdFusion applications via SharePoint

SharePoint custom Web Parts let you access multiple ColdFusion applications from the SharePoint server using Single Sign-On (SSO). After signing in, users can access multiple secure ColdFusion applications by accessing ColdFusion services from multiple Web Parts.

To make a ColdFusion application available from SharePoint, use the PageViewer Web Part template that is shipped by default in Windows Sharepoint Services 2 and 3. The PageViewer Web Part template is customized to enable single sign-on.

Remember these points:

  • Web Parts support only the native single sign-on solution; other pluggable single sign-on services are not supported.

  • Only single sign-on credentials are passed to the ColdFusion application. The ColdFusion application must have the necessary logic to retrieve the credentials and login to the application.

Deploy the CFSSOWebPart.wsp Web Part for SharePoint Portal Server 2007

To configure single sign-on for SharePoint Server 2007, deploy the CFSSOWebPart.wsp file to the SharePoint server.

  1. Copy the CFSSOWebPart.wsp file to the BIN folder within the Web Server extensions. It is normally located at Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN in the SharePoint server.

  2. To deploy the solution to SharePoint, use the command prompt to navigate to Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN and enter the following commands, as required.

    To delete the solution if it is already present:

    STSADM.EXE -o deletesolution -name CFSSOWebPart.wsp -override

    To add the solution to SharePoint:

    STSADM.EXE -o addsolution -f CFSSOWebPart.wsp

    To deploy the solution to the configured website by specifying the URL:

    STSADM.EXE -o deploysolution -name CFSSOWebPart.wsp 
    -url <virtual server url> -local -allowGacDeployment

    To deploy the solution to all the configured websites:

    STSADM.EXE -o deploysolution -name CFSSOWebPart.wsp -local -allowGacDeployment

Import the CFSSOWebPart.wsp Web Part into a Web Part Page

  1. Navigate to the web page on the SharePoint server where you want the Web Part to be accessible.

  2. In the Web Part page, click Site Actions > Site Settings.

  3. In the Site Settings page, click Galleries > Web Parts.

  4. In the Web Part gallery, click Upload in the toolbar pane.

  5. Select the CFSSOWebPart.wsp Web Part.

  6. Enter the following details in the toolbar pane.

    • URL of the ColdFusion application to access

    • The form field name as the User ID

    • The form field name as the password

    • Name of the SSO application where the credentials are configured

Once the Web Part is deployed, it takes the credentials from the SharePoint Single Sign-On database (based on the application name entered in the Tools Pane). These credentials are transferred to the ColdFusion application through the URL (provided in the Tools Pane) in a FORM containing the specified form fields.

Deploy the CFSharepointSSOCab.CAB Web Part for SharePoint Portal Server 2003

To configure single sign-on for SharePoint Server 2003, deploy the CAB file - CFSharepointSSOCab.CAB

  1. Copy the CFSharepointSSOCab.CAB to the BIN folder within the Web Server extensions. It is normally located at Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\BIN in the SharePoint server.

  2. Create a folder named CFSharePointSSO within the Layouts folder. The Layouts folder is normally located at Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\Template\Layouts.

  3. From the CFSharepointSSOCab.CAB file, copy the template file CFSSO.aspx to the CFSharePointSSO folder that you created in the previous step.

  4. In the command prompt, navigate to Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin and enter the following command to add the CAB file:

    stsadm.exe -o addwppack -filename CFSharepointSSOCab.CAB -globalinstall
    If the CAB file exists, delete the CAB file and then enter the command to add the CAB file as follows:
    stsadm.EXE -o deletewppack -name CFSharepointSSOCab.CAB
    stsadm.exe -o addwppack -filename CFSharepointSSOCab.CAB -globalinstall

Configure the CFSharepointSSO Web Part

  1. In the Site Settings page, go to Manage Security and Additional Settings > Manage Web Part Gallery.

  2. Click New in the toolbar in the Web Part Gallery. The New Web Parts List appears.

  3. Select the CFSSOwebpart.dwp Web Part and click Populate Gallery.

  4. Add the CFSharepointSSO Web Part to the Virtual Server Gallery. Clicking Edit Page > Modify Shared Page > Add Web Parts > Browse > Virtual Server Gallery. Then add the Web Part to the Web Parts list.

  5. After adding the CFSharepointSSO Web Part, click the Tools pane and enter the following details.

    • URL of the ColdFusion application to access

    • The form field name as the User ID

    • The form field name as the password

    • Name of the SSO application where the credentials are configured

Once the Web Part is deployed, it takes the credentials from the SharePoint Single Sign-On database (based on the application name entered in the Tools Pane). These credentials are transferred to the ColdFusion application through the URL (provided in the Tools Pane) in a FORM containing the specified form fields.