7 Replies Latest reply on Mar 9, 2011 8:11 PM by Designscripting

    Write data to SharePoint from embeded Flex swf

    ajdove Level 1

      I am trying to integrate Flex 3 applications into SharePoint 2007 environment which would allow our users to read/write/delete data from SharePoint using an embeded Flex app inside SharePoint. While the article from matthew.meier on "Adding Event Driven Flex Components to Microsoft Sharepoint 2007" is great and another article by Serge van den Oever on "Use Flex to retrieve data from a SharePoint list" is fantastic, they neither touch the topics of writing or inserting data into SharePoint. My goal is to create a two-way communication between Flex and SharePoint to dynamically pull (read) data into Flex  from SharePoint lists, etc via GUID or other method AND to also write or update SharePoint from a front-end Flex inside SharePoint.

        • 1. Re: Write data to SharePoint from embeded Flex swf
          ajdove Level 1

          Referencing the above articles I have been able to READ data from a SharePoint list into a Flex app inside SharePoint. This is good progress. I used the GUID of the list and pulled the data using a Web Service. Although the data I initially pulled from a list in SharePoint was the last record in a list of 7 or 8 items, it still pulled the list. I am glad and pushing forward attemting to write data to SharePoint from a Flex app. If you have any help or recommendations please post.



          • 2. Re: Write data to SharePoint from embeded Flex swf
            ajdove Level 1

            Would it be possible to have SharePoint use the Shared Objects from Flex to enable the data to be brought into SharePoint. Possibly have the Shared Objects converted to XML and then have SharePoint bring in those XML lists?

            • 3. Re: Write data to SharePoint from embeded Flex swf
              ajdove Level 1

              Is it possible to write data from Flex directly to the SharePoint database? That way we can access the data directly from SharePoint. It eliminates the middle element of Flex interacting with SharePoint and cuts straight to the point.  Any ideas?

              • 4. Re: Write data to SharePoint from embeded Flex swf
                oldMster Level 3

                Don't think you can do that, it would violate the security enforced for browser based applications.  You might be able to do it with Air, but not with flex running in Flash play in a browser.  You have to interact with a published service (HTTP server, Web Service, etc.)- no direct access to local resources is allowed.  If you can do it, what would stop the average hacker from doing it also?


                • 5. Re: Write data to SharePoint from embeded Flex swf
                  ajdove Level 1

                  Correct, I agree on the restrictions, but I am looking for help with writing a solution to either:


                  • use HTTPService
                  • use WebService
                  • use SharedObjects
                  • use LoadVars


                  I am working with SharePoint MOSS 2007 and am locked down from writing custom web parts. My tentative solution was to use Flex to integrate into SharePoint and read/write data into SharePoint lists so that it would be stored into the SharePoint databases. The Flex would be more of a front-end interface for writing forms, reading data in datagrids, and other interactions with the SharePoint data.


                  I do not know how to write a C# web service nor do I know how to work with HTTPServices. I know that SharedObjects are similar to cookies and are stored locally on a client's machine, however, I wonder if there is a way to pull these SharedObject data files into SharePoint.  For instance, say I am making a game and every time a user scores a point that point is stored into a SharedObject. If I want a leaderboard to position the best/worst game scores in SharePoint I would want to pull the data from the SharedObjects. Is this possible?


                  Since I am locked out of writing custom web parts, adding code files to the file system on the server, I am left with custom manipulation of code object in the SharePoint pages themselves, such as using the Content Editor Web Parts. I embed flash/flex apps, jQuery, and CSS into these SharePoint containers to help me manipulate the site, so is there a way I can incorporate these other ideas into a working solution this same way?


                  Much Thanks.


                  • 6. Re: Write data to SharePoint from embeded Flex swf
                    ajdove Level 1

                    I have been working on a solution which appears like it would work, but I am getting errors. The source code and examples are found on Code Project http://www.codeproject.com/KB/aspnet/FlexASPWebService.aspx?msg=3270246#xx3270246xx This Flex/ASP example uses a web service to communicate to a SQL database. Flex makes a web service call to the .asmx file via WSDL and the magic happens. I am running into a roadblock as I receive an error that the app cannot find the WSDL. I have tried to run the same WSDL URL in a browser and I get an server application error.


                    I also tried a solution found at http://shardulbartwal.wordpress.com/2008/03/20/import-web-servicewsdl-wizard-in-flex-30/ to load the WSDL file directly into Flex, but I ran into another roadblock. When I get to this step below Flex gives an error that it cannot find the WSDL file either…



                    Here is the WebService call from Flex…


                    The files from Code Project contain a directory structure as such:


                    The Service.cs file is inside the App_Code directory and is referenced from the Service.asmx file with this code:

                    My Flex file calls the Service.asmx?WSDL which then calls the file Service.cs and then it breaks. :(



                    The Code for the Flex file is as follows…


                    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">




                                import mx.controls.Alert;

                                import mx.rpc.events.FaultEvent;

                                import mx.rpc.events.ResultEvent;


                                private function init():void {

                                      // Get Data from WebService and fill datagrid when you fist invoke the application




                                private function GetEmployees(event:ResultEvent):void {

                                      // Databind data from webservice to datagrid

                                      datagrid.dataProvider = event.result;


                                private function SaveEmployee(event:ResultEvent):void {

                                      // To Refresh DataGrid;


                                      Alert.show("Saved Successfully");


                                private function AddRecord(event:MouseEvent):void {

                                      // Save a record using a WebService method

                                      ws.SaveEmployee(txtEmpId.text, txtEmpName.text, txtEmpEmail.text); //


                                private function fault(event:FaultEvent):void {

                                      // Oppps some error occured








                    <!-- WebService definition -->

                    <mx:WebService id="ws" wsdl="http://localhost/TestWebService/Service.asmx?WSDL" fault="fault(event)">












                          <mx:Panel x="41.5" y="66" width="714.5" height="237" layout="absolute" title="ASP.NET WebService + Flex Demonstration">

                                <mx:HBox height="95%" width="95%" horizontalCenter="0" verticalCenter="0">

                                      <mx:DataGrid id="datagrid" width="465" height="100%">


                                                  <mx:DataGridColumn headerText="Emp Id" dataField="EmpId"/>

                                                  <mx:DataGridColumn headerText="Emp Name" dataField="EmpName"/>

                                                  <mx:DataGridColumn headerText="Emp Email" dataField="EmpEmail"/>



                                      <mx:Form x="608" y="74" width="100%" height="100%" borderStyle="solid">

                                            <mx:FormItem label="EmpId">

                                                  <mx:TextInput width="106" id="txtEmpId"/>


                                            <mx:FormItem label="EmpName">

                                                  <mx:TextInput width="106" id="txtEmpName"/>


                                            <mx:FormItem label="EmpEmail">

                                                  <mx:TextInput width="106" id="txtEmpEmail"/>


                                            <mx:FormItem width="156" horizontalAlign="right">

                                                  <mx:Button label="Add" id="btnAdd" click="AddRecord(event)"/>








                    The Flex app error states it cannot locate the WSDL. Any ideas?

                    I don’t know what I am doing wrong…

                    • 7. Re: Write data to SharePoint from embeded Flex swf

                      SharePoint and Flex or Flash integration is easy with SharePoint Flex library.


                      I found this tutorial very useful


                      http://www.designscripting.com/2011/03/sharepoint-2010-flash-cs5-flex-4-integration-connec t-to-sharepoint-2010/