Home » ActionScript 3.0, Flex, Sharepoint

Sharepoint 2010 Flash CS5 / Flex 4 integration | Connect to SharePoint 2010

9 March 2011 19 Comments
Share on Facebook

SharePoint Platform exposes Web services apart from web user interface, to connect and access the data from SharePoint.

We can utilize the SharePoint Web Services to manipulate or display in Flash or Flex. SharePoint Web Services can be accessed across the network boundary.

We are going to use the SharePoint Connector- ActionScript classes which connects to SharePoint Web Services.Big advantage of this SharePoint Connector classes will work with SharePoint 2007/2010 and backward compatible with Flash and Flex software.

Flash and Flex is capable of calling webservices. I have used gofr: AS3 Web Service to create this class. Lets see how to connect SharePoint with Flex by making use of SharePoint Connector Library.

Download the SharePoint Connector library. Contains com and lib folder.

Connect to SharePoint 2010 using Flash CS5:

Now connecting or Integrating SharePoint 2010 with Flash CS5 is easy with SharePoint Connector Library.

Create new Flash Document (ActionScript 3.0) and Save it on Disk

Add the SWC files to Flash CS5 file from the libs folder and copy classes to .fla saved

Add the following code in first frame.

import com.sharepoint.SharePointConnector;
import com.sharepoint.events.SharepointEvent;

var _sharepoint:SharePointConnector = new SharePointConnector();
_sharepoint.connect( "http://ea.sharepoint.designscripting.com/teams/CONNECTOR" );
_sharepoint.addEventListener( SharepointEvent.CONNECTED, handleConnectedEvent );

function handleConnectedEvent( e:SharepointEvent ):void
{
	trace( "Sharepoint Connected:::"+e.connected );
}

Note:
I have used the SharePoint home page link here “http://ea.sharepoint.designscripting.com/teams/CONNECTOR” from http://ea.sharepoint.designscripting.com/teams/CONNECTOR/default.aspx

Please use your site URL here.

Code Explanation:

Import necessary class files

import com.sharepoint.SharePointConnector;
import com.sharepoint.events.SharepointEvent;

Create new SharePointConnector object

var _sharepoint:SharePointConnector = new SharePointConnector();

Connect to a SharePoint Site using Connect method of SharePointConnector, Pass the site URL as parameter, then add SharepointEvent.CONNECTED Event that will be triggered once connected.

_sharepoint.connect( "http://ea.sharepoint.designscripting.com/teams/CONNECTOR" );
_sharepoint.addEventListener( SharepointEvent.CONNECTED, handleConnectedEvent );

Connect to SharePoint 2010 using Flex 4 (Flash builder):

Create New web Project in Flash builder

Add the downloaded SWC to the libs folder

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" 

creationComplete="init()">
	<fx:Script>
		<![CDATA[
			import com.sharepoint.SharePointConnector;
			import com.sharepoint.events.SharepointEvent;

			import mx.controls.Alert;

			private function init():void
			{
				var _sharepoint:SharePointConnector = new SharePointConnector();
				_sharepoint.connect( "http://ea.sharepoint.designscripting.com/teams/CONNECTOR" );
				_sharepoint.addEventListener( SharepointEvent.CONNECTED, handleConnectedEvent );
			}

			private function handleConnectedEvent( e:SharepointEvent ):void
			{
				Alert.show( "Sharepoint Connected:::"+e.connected );
			}
		]]>
	</fx:Script>

</s:Application>

Code Explanation:

Same as the SharePoint to Flash CS5 .

Conclusion:

We have seen how to integrate Flash builder with SharePoint 2010. In next tutorials we are going to see how to integrate Flash or Flex to

  • Add, Delete, Update Sharepoint list
  • Add attachment to Sharepoint List
  • Read a Sharepoint List

Thanks to Carlo Alducente for webservice Classes used in Sharepoint connector and as3base64 lib from google code.

Please comment for queries.

Download SharePoint Connector Sample Files

 

No related posts.

GET THE UPDATES VIA EMAIL

We don't share your email anywhere, grab our rss via feedburner


  • FlexJack

    Hi,
    When we try to connect to sharepoint we are required to enter the username and password using windows authentication.I want to authenticate from flex application using Authentication.aspx webservice without opening the windows authentication window.Can anyone help me to solve this issue?
    Thanks & regards

  • http://www.designscripting.com/ admin

    FlexJack,

    The class to read Authentication.aspx webservice is not added into the library.

    Please stay connected.

    -saravanan

  • Adam

    This is really the best ever, good job Saravanan and Carlo!

    Question: is it possible to access picture libraries via the connection kit (since picture libraries, I believe, are lists too) Or would I just have to extend functionality to the classes you already have. I suppose this goes for any sort of access to sharepoint webservices.

    thanks again,

    Adam

  • abhisekh

    Hi can you provide the detail for doing an authentication from the flex application.Where is the class for doing authentication.

  • http://www.designscripting.com/ admin

    The class to read Authentication.aspx webservice is not added into the library.

    Please stay connected.

    -saravanan

  • abhisekh

    Hi saravanan great work and i really appreciate it.I went through the code and also did some study of my own on sharepoint authentication .i found out that we have to use the authentication web service.well i am using it from my flex side but how to get the authentication done is were i am confused.i am trying to create an operation called login and providing the credentials but and then sending a request to it.i am confused whether we have to create a login method here or we have to use some method of the service.

  • abhisekh

    hi saravanan can u tell me how to access the contents of the folder indside a list.i am able to get to the list through the list id but i am not able to access the contents of the folder in that list.please help.

  • HB

    I must be missing something because I have tried all of the SharePoint integration here on either 2007 or 2010 and still can’t get them to work….

    Some of you say they work for you so please let me know what the secret is….

    Thanks,

    HB

  • http://orionxl.ru Игрок

    Thanks for the source code, they really helped

  • HB

    Thank you Sara but I am still missing something because even after trying to us the sample it is just not working…How about a quick video???

    -HB

  • BobHope

    When I try to run the sample file I am getting an Error:n nScene 1, Layer ‘Layer 1′, Frame 1, Line 8t1046: Type was not found or was not a compile-time constant: SharepointEvent.nnNot sure what I am missing

  • BobHope

    When I try to run the sample file I am getting an Error:n nScene 1, Layer ‘Layer 1′, Frame 1, Line 8t1046: Type was not found or was not a compile-time constant: SharepointEvent.nnNot sure what I am missing

  • http://twitter.com/DeanLogic Dean Logan

    Maybe I am missing something here, but this only pulls back the first 30 rows on the view. Do you have to loop through until all the rows are pulled back?

  • http://twitter.com/DeanLogic Dean Logan

    Maybe I am missing something here, but this only pulls back the first 30 rows on the view. Do you have to loop through until all the rows are pulled back?

  • Anonymous

    Hi, nnTry to import the sharepoint event..

  • Anonymous

    Hi, nnTry to import the sharepoint event..

  • Joy Smth

    Hi, nnAs Dean said, I am also unable to get all the rows.The XML which I am getting is of size 174KB.I can read till 210 rows but not completely.Can you please tell me what I am missing?

  • Anonymous

    Hi Joy, Dean,nnSet the row limit for the deafult view in sharepoint site.nn-sara

  • Anonymous

    Havent check that yet…