Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Web Services Help

$
0
0

Hi,

I have an Excel Web Access webpart, where  a user is allowed to enter certain parameters in the published workbook and after entering the parameters, what I want to do is have them click a button to route a publishedworkbook snapshot tp a document library with values extracted from couple of cells to promote as document library columns. So far, what I have done is I have written a console application that lets me download the published workbook snapshot to my local machine. Code is below.  I have couple of questions,

1) With below console application code I was able to download the published snapshot to my local machine . However, I am not getting the values that a user entered in a session in cells that are designated as named parameters. Please note that we are using GetWorkbook method by passing in the current sessionID. so a published snapshot should return a workbook in its current active session. How do I fix this?

2) How do I modify below code using Sharepoint Client object model to route the workbook to a document library by extracting values from one or two cells . Typically, I want the user be able to click a button during his session and has this action take place. What is the best way to build a sandbox solution for this? Any guidance will be helpful.

3) Can this also be achieved using EWA Javascript API in combination with Javascript Client object model in SharePoint 2010?

 

namespace GetSnapshot
{
    class ExcelServiceSnapshot
    {
        static void Main(string[] args)
        {

            try
            {
                if (args.Length < 1)
                {
                    Console.Error.WriteLine("Command line arguments should be: GetSnapshot [workbook_path] > [snapshot_filename]");
                    return;
                }

                //instantiate the web service and create a status array object.

                ExcelService xlservice = new ExcelService();

                Status[] status;

                xlservice.Timeout = 600000;

                //set credentials for requests.
                //Use the current user's logon credentials.

                xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials;

                //open the workbook, then call GetWorkbook and close the session.

                string sessionId = xlservice.OpenWorkbook(args[0], "en-US", "en-US", out status);

                byte[] workbook = xlservice.GetWorkbook(sessionId, WorkbookType.PublishedItemsSnapshot, out status);

                //close the workbook. This also closes the session, proactively releasing resources on the server
                //status = xlservice.CloseWorkbook(sessionId);

                //write the resulting Excel file to stdout as a binary stream.
                BinaryWriter binaryWriter = new BinaryWriter(Console.OpenStandardOutput());

                binaryWriter.Write(workbook);
                binaryWriter.Close();
                
            
            
            }

        catch (SoapException e)

        {

            Console.WriteLine("SOAP Exception Message: {0}", e.Message);
        }

       catch (Exception e)

        {

          Console.WriteLine ("Exception Message: {0}", e.Message);

       }

        }
    }
}

Thanks in advance



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>