cfsharepoint

Description

Invokes a feature that SharePoint exposes as a web service action, such as the Document Workspace getdwsdata action.

Category

Extensibility tags, MS Office Integration tags.

Syntax

<cfsharepoint 
    action="webservice action" 
    params="parameter structure" 
    domain="domain name" 
    name ="result variable name" 
    password="connection password" 
    userName="user ID" 
    wsdl="WSDL file path"> 
or 
 
<cfsharepoint 
    action="webservice action" 
    params="parameter structure" 
    login = "credentials structure" 
    name ="result variable name" 
    wsdl="WSDL file path">
Note: You can specify this tag’s attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag’s attribute names as structure keys.

History

ColdFusion 9: Added tag.

Attributes

Attribute

Req/Opt

Default

Description

action

Required

 

The name of a web service action. See Usage for the list of service actions you can specify.

domain

Optional

 

The domain name required to connect to the SharePoint server. Required if you do not specify a login attribute.

login

Optional

 

A structure containing user, password, and domain login credentials to pass to the service. If you do not specify domain, password, and userName attributes, specify a login structure with domain, password, and userName entries.

name

Optional

 

Name of the result variable in which to put the data returned by the SharePoint service.

params

Optional

 

A structure containing names and values of the parameters to pass to the service.

This attribute is required for any service that requires parameters.

password

Optional

 

The password required to connect to the SharePoint server. Required if you do not specify a login attribute.

userName

Optional

 

The user name required to connect to the SharePoint server. Required if you do not specify a login attribute.

wsdl

Optional

 

Path to the service wsdl file. Required to invoke an action that is not in the list of supported actions. See Usage for details.

Usage

The cfsharepoint tag invokes a Microsoft SharePoint web service. You call many SharePoint web service actions by specifying the action name in the action attribute and passing the web service parameters in the params attribute. You access the services and methods that the cfsharepoint tag does not support directly by specifying the service WSDL URLs in the wsdl attribute.

Note: You can use the cfsharepoint tag with servers that use basic authentication only.
You request a service and action by specifying the action attribute values listed in the following tables. In nearly all cases, these are identical to the SharePoint action names. Notes indicate where the attribute values differ from the action names because multiple services have the same action name.
Note: The web service action parameters are documented at http://msdn.microsoft.com/en-us/library/ms445292.aspx. You can also determine the parameters from the web service WSDL, at http://server_name/_vti_bin/WebServiceName?wsdl.

When the cfsharepoint tag receives the results from the SharePoint server and completes, the structure specified by the name attribute contains the response. This structure also has a ResultFlag entry containing the value Success or Failure. The entry value is Success if there is no Axis Fault or an error is returned in the response, otherwise, the value is Failure.

Document Workspace

cancreatedwsurl

deletedwsfolder

renamedws

createdws

finddwsdoc

updatedwsdata

createdwsfolder

getdwsdata

 

deletedws

removedwsuser

 

Note: The createdwsfolder and deletedwsfolder action attribute values correspond to the createfolder and deletefolder actions of the Document Workspace service.

Imaging

delete

getitemsbyids

upload

download

listpicturelibrary

 

getimaginglistitems

rename

 

Note: The getimaginglistitems action attribute value correspond to the getlistitems action of the Imaging service.

Lists

addattachment

getattachmentcollection

updatelist

addlist

getlist

updatelistitems

deleteattachment

getlistcollection

 

deletelist

getlistitems

 

Search or spsearch

Note: spsearch/search is not present in Windows Sharepoint Services 2.0.

In Windows SharePoint Services 3.0, if the action attribute specifies any of the following actions, the spsearch.asmx web service is used to perform the search. In SharePoint Portal 2003 or 2007, search.asmx is used to perform the search. In Windows Sharepoint Services 2.0, an exception is thrown.

query

registration

queryex

status

UserGroup

addgrouptorole

getgroupcollection

removerole

addrole

getrolecollection

removeusercollectionfromgroup

addusercollectiontogroup

getusercollectionfromrole

removeuserfromgroup

addusercollectiontorole

getusercollectionfromrole

 

addusertogroup

getuserinfo

 

Views

addview

getview

updateview

deleteview

getviewcollection

 

Data type conversion

Some web service actions require parameters in a Microsoft data type that does not correspond directly to a ColdFusion data type. The cfsharepoint tag automatically converts between the Microsoft data types and the most appropriate Java data types, which ColdFusion uses internally. The following table lists the conversions, and indicates the corresponding ColdFusion data type.

SharePoint data type

ColdFusion Java data type

XmlNode

XMLNodeList - corresponds to a ColdFusion XML object, for example created by passing an XML string to the XmlParse function.)

ArrayOfString

string array - corresponds to a ColdFusion array containing string data.

UnsignedInt

int - corresponds to a ColdFusion number that is an integer value

ArrayOfUnsignedInt

int array - corresponds to a ColdFusion array containing string data.

Example

The following example shows how you can manipulate lists and views. It requires resources on the SharePoint server that are not specified here.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<html> 
<head> 
    <title>cfsharepoint Views Example</title> 
</head> 
 
<body> 
<cfoutput> 
 
Getting the list collection<br /> 
<!--- All login information is defined using variables in the Application.cfc file. ---> 
<cfsharepoint action="getlistcollection" login="#login#" name="result"/> 
 
result.ResultFlag: #result.ResultFlag#<br><br> 
     
Deleting mycustomlist from the collection, if it exists.<br> 
<cfloop array=#result.lists# index="list"> 
    <cfif list.Title EQ "mycustomlist"> 
        <cfsharepoint action="deletelist" login="#login#"  
         name="result1" params="#{listname="mycustomlist"}#"/> 
    </cfif> 
</cfloop> 
 
    Was anything deleted? 
<cfif IsDefined("result1")> 
    <b>YES.</b> The result is:</b><br> 
    <cfdump var="#result1#"><br> 
<cfelse> 
    <b>NO</b> 
</cfif> 
     
Adding a mycustomlist list<br /> 
<cfsharepoint action="addlist" login="#login#"  name="result1"  
    params="#{listname="mycustomlist", 
        description="Adding a list via cfsharepoint", 
        templateid=100}#"/> 
 
addlist result.ResultFlag: #result1.ResultFlag#<br><br> 
 
     
<cfset viewFields = xmlparse("<ViewFields> 
                                 <FieldRef Name='Title'/> 
                                 <FieldRef Name='ID'/> 
                                 </ViewFields>")> 
     
<cfset query = xmlparse("<Query> 
                             <Where> 
                             <Lt> 
                             <FieldRef Name='ID'/> 
                             <Value Type='Counter'>10</Value> 
                             </Lt> 
                            </Where> 
                            <OrderBy> 
                            <FieldRef Name='ID'/> 
                             </OrderBy> 
                             </Query>")>        
     
<cfset rowlimit = xmlparse("<RowLimit Paged='True'>50</RowLimit>")> 
     
Adding a myview1 view for the mycustomlist list<br /> 
<cfsharepoint action="addview" login="#login#" name="result"  
    params="#{listName="mycustomlist",viewname="myview1", 
    viewFields="#viewFields#",    query="#query#",rowlimit="#rowlimit#", 
    type="grid",makeViewDefault=false}#"/>  
 
addview result.ResultFlag: #result.ResultFlag#<br><br> 
 
 
Adding a myview3 view for the mycustomlist list<br /> 
<cfsharepoint action="addview" login="#login#" name="result" params="#{listName="mycustomlist",viewname="myview3",viewFields="#viewFields#", 
    query="#query#",rowlimit="#rowlimit#",type="grid",makeViewDefault=false}#"/>  
 
addview result.ResultFlag: #result.ResultFlag#<br><br> 
     
Getting the updated mycustomlist view collection<br> 
<cfsharepoint action="getviewcollection" login="#login#" name="result"  
    params="#{listName="mycustomlist"}#"/>  
 
<b>getviewcollection result</b><br> 
<cfdump var="#result#"><br /> 
 
The names of the collection's views:<br> 
<cfloop array=#result.views# index=v> 
<cfoutput>#v.displayname#<br></cfoutput> 
</cfloop> 
<br> 
 
Deleting the list<br> 
<cfsharepoint action="deletelist" login="#login#" name="result1" params="#{listname="mycustomlist"}#"/> 
 
deletelist result.ResultFlag: #result1.ResultFlag# 
</cfoutput> 
 
</body> 
</html>