Unanswered Writing to Parameters programmatically

  • Wednesday, July 21, 2010 6:42 PM
     
      Has Code
    //try
          //{
          //  using (ClientContext clientContext = new ClientContext(server))
          //  {
          //    Web site = clientContext.Web;
          //    clientContext.Load(site);
          //    clientContext.ExecuteQuery();
          //    Microsoft.SharePoint.Client.List list = clientContext.Web.Lists.GetByTitle(listName);
          //    CamlQuery camlQuery = new CamlQuery();
          //    camlQuery.ViewXml =
          //    @"<View><Query><Where><And><Eq><FieldRef Name='UserAlias'/><Value Type='Text'>" + app.User + "</Value></Eq><Eq><FieldRef Name='Title'/><Value Type='Text'>" + reportName + "</Value></Eq></And></Where></Query><RowLimit>100</RowLimit></View>";
          //    Microsoft.SharePoint.Client.ListItemCollection listItems = list.GetItems(camlQuery);
          //    clientContext.Load(list);
          //    clientContext.Load(listItems);
          //    clientContext.ExecuteQuery();
          //    if (listItems.Count > 0)
          //    {
          //      string sReport = RptUrl.Replace("/_layouts/xlviewer.aspx?id=", "");
          //      int iLen = sReport.Length;
          //      int iPos = sReport.IndexOf("&");
          //      sReport = sReport.Substring(0, iPos);
          //      sReport = sReport.Replace("%2F", "/");
    
          //      _file = new ExcelServiceSoapClient();
    
          //      Uri _fileName = new Uri(@sReport);
    
          //      BasicHttpBinding httpBinding = new BasicHttpBinding();
          //      httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
          //      httpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
          //      httpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
    
          //      string excelServiceUrl = server + "/_vti_bin/ExcelService.asmx";
          //      EndpointAddress endpointAddress = new EndpointAddress(excelServiceUrl);
    
          //      this._file = new ExcelServiceSoapClient(httpBinding, endpointAddress);
          //      this._file.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
          //      ExcelService.Status[] s;
    
          //      ExcelService.RangeCoordinates rangeCoordinates = new ExcelService.RangeCoordinates();
    
          //      _fileSessionId = _file.OpenWorkbook(_fileName.AbsoluteUri, string.Empty, string.Empty, out s);
    
          //      foreach (Microsoft.SharePoint.Client.ListItem listItem in listItems)
          //      {
          //        ParameterInfo[] p = new ParameterInfo[1];
          //        ParameterInfo param = new ParameterInfo();
    
          //        param.Name = listItem["ParameterName"].ToString();
          //        param.Values = new ArrayOfString();
          //        string pValues = listItem["ParameterValue"].ToString();
          //        string[] sValues = pValues.Split('|');
          //        foreach (string sMyValue in sValues)
          //        {
          //          param.Values.Add(sMyValue);
          //        }
          //        p[0] = param;
          //        s = _file.SetParameters(_fileSessionId, p);
          //      }
    
          //      //string val = (string)_file.GetCellA1(_fileSessionId, "Metric Pivots", "eCPM", true, out s);
          //      //_file.SaveWorkbook(_fileSessionId);
                
    
          //      //loadReport(_fileName.ToString());
    
          //      s = _file.CloseWorkbook(_fileSessionId);
          //      _file.Close();
          //      //loadReport(RptUrl);
          //    }
          //    else
          //    {
          //      loadReport(RptUrl);
          //    }
          //  }
          //}
          //catch (Exception ex)
          //{
          //  System.Windows.MessageBox.Show(ex.InnerException.ToString());
          //}
    

    Hi all,

    I am building an application that allows users to view report (Power Pivot) stored on a SharePoint server in an Outlook Browser. One feature the client would like is to be able to allow each user to save his/her preferences (filters, etc.).  These prefenerces are being stored in a SharePoint list and when the user requests a report we, retrieve their preferences for that report and open the report with their preferences (theoretically).  I have tried using Excel Services with setParamters to change the slicer values but have not been successful at getting this work.  Performance is terrible and even after waiting for 2-3 minutes I don't see the results I would expect.

    Does anyone know if there is a way to do what we want easily and if so does anyone have any sample code?   Below is the code I have been trying to get working.

    Thanks,

    Rhonda