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>

 Adobe

Get help faster and easier

New user?