FileOpenAccessDenied Exception

Hopefully, someone can help me. I have a web part calling out to the Excel Services web service (code appears below). I am simply trying to return the value from a cell, but I can't even get the file open.

I am getting the FileOpenAccessDenied exception, even though the user is a site owner for everything, from the site collection on down. I have even tried overriding permissions in the doc library to ensure that the user is the owner.

I have set up the entire site collection as a trusted location for Excel Services.

I have published a major version of the spreadsheet in the document library.

Can someone please help me? I have been fighting this for two days.

Here is my web part code:

using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

using ExcelAggregate.ExcelSvcs; //Web Reference to Excel Web Services
using System.Web.Services.Protocols;

namespace ExcelAggregate
{
[Guid("27626ed1-ec63-4b9b-b327-365f321ec002")]
public class ExcelAggregate : System.Web.UI.WebControls.WebParts.WebPart
{
protected override void Render(HtmlTextWriter writer)
{
// TODO: add custom rendering code here.
// writer.Write("Output HTML");
try
{
ExcelService es = new ExcelService();
es.SoapVersion = SoapProtocolVersion.Soap12;
string wkshtName = "Historical";
string tgtBook = "http://intranet.demo.com/Reports/Excel%20Sheets/2007%20CHI%20-%20MS%20Business%20Plan%202007.xlsx";
//System.Net.NetworkCredential newCred = new System.Net.NetworkCredential("Administrator", "P@ssw0rd", "DEMO");
es.Credentials = System.Net.CredentialCache.DefaultCredentials;
Status[] outStatus;
string sessionID = es.OpenWorkbook(tgtBook, "en-US", "en-US", out outStatus);
writer.Write("Session ID: " + sessionID + "<BR>");
object cellVal = es.GetCell(sessionID, wkshtName, 31, 1, true, out outStatus);
writer.Write(cellVal.ToString());
es.CloseWorkbook(sessionID);
}
catch (SoapException ex)
{
writer.Write("SOAP Exception Message: {0}<BR><BR>", ex.Message);
writer.Write("SOAP Exception Error Code: {0}", ex.SubCode.Code.Name);
}
}
}
}

[2862 byte] By [JoeMack] at [2008-2-7]
# 1

Joe,

1. Is the WebPart rendered on the same site that you're trying to access the ExcelService soap service? (e.g. intranet.demo.com).

if so, you can try to linking directly with the soap service api's instead of making a soap call to the ExcelService soap service.

See: http://msdn2.microsoft.com/en-us/library/ms565591.aspx

2. Are all server services (SharePoint and Application Server) installed on the same machine?

IraLevin at 2007-9-6 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Excel Services...
# 2

string tgtBook = "http://intranet.demo.com/Reports/Excel%20Sheets/2007%20CHI%20-%20MS%20Business%20Plan%202007.xlsx";

Your problem is probably here. Try replacing the %20s with spaces (just put in the real file name).

ShaharPrish-MSFT at 2007-9-6 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Excel Services...
# 3

Joe,

Did the above posts answer your question? If so could you please mark it as the answer?

Otherwise let us know what you still need help with.

Thanks!

- Luis

SharePoint Products and Technologies

Site Classified