2016-07-26 100 views
0

我正在研究一种C#实用程序,它可以帮助客户在其网站上发布SSRS报告。在这里我的代码:SSRS报告门户管理

public void createFolder() 
    { 
     ReportingService2010 rs = new ReportingService2010(); 
     rs.Credentials = System.Net.CredentialCache.DefaultCredentials; 

     // Create a custom property for the folder. 
     Property newProp = new Property(); 
     newProp.Name = "Department"; 
     newProp.Value = "Finance"; 
     Property[] props = new Property[1]; 
     props[0] = newProp; 

     string folderName = "Budget"; 

     try 
     { 
      rs.CreateFolder(folderName, "/", props); 
      Console.WriteLine("Folder created: {0}", folderName); 
     } 

     catch (SoapException e) 
     { 
      Console.WriteLine(e.Detail.InnerXml); 
     } 
    } 

我收到以下错误:

ErrorCode xmlns="http://www.microsoft.com/sql/reportingservices">rsAccessDenied</ErrorCode><HttpStatus xmlns="http://www.microsoft.com/sql/reportingservices">400</HttpStatus><Message xmlns="http://www.microsoft.com/sql/reportingservices">The permissions granted to user 'NT AUTHORITY\NETWORK SERVICE' are insufficient for performing this operation.</Message><HelpLink xmlns="http://www.microsoft.com/sql/reportingservices">https://go.microsoft.com/fwlink/?LinkId=20476&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsAccessDenied&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=13.0.1601.5</HelpLink><ProductName xmlns="http://www.microsoft.com/sql/reportingservices">Microsoft SQL Server Reporting Services</ProductName><ProductVersion xmlns="http://www.microsoft.com/sql/reportingservices">13.0.1601.5</ProductVersion><ProductLocaleId xmlns="http://www.microsoft.com/sql/reportingservices">127</ProductLocaleId><OperatingSystem xmlns="http://www.microsoft.com/sql/reportingservices">OsIndependent</OperatingSystem><CountryLocaleId xmlns="http://www.microsoft.com/sql/reportingservices">1033</CountryLocaleId><MoreInformation xmlns="http://www.microsoft.com/sql/reportingservices"><Source>ReportingServicesLibrary</Source><Message msrs:ErrorCode="rsAccessDenied" msrs:HelpLink="https://go.microsoft.com/fwlink/?LinkId=20476&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsAccessDenied&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=13.0.1601.5" xmlns:msrs="http://www.microsoft.com/sql/reportingservices">The permissions granted to user 'NT AUTHORITY\NETWORK SERVICE' are insufficient for performing this operation.</Message></MoreInformation><Warnings xmlns="http://www.microsoft.com/sql/reportingservices" /> 

任何想法?

请注意,此练习的一点不仅仅是让它工作,而且知道它将在理想情况下在客户端运行,而不需要对其进行任何调整。

感谢您的帮助。

+0

你有没有[谷歌错误](https://sqldude.wordpress.com/2008/12/24/the-permissions-granted-to-user-nt-authoritynetwork-service-are-insufficient-对于表现 - 这一操作-rsaccessdenied /)?如果是这样,你到目前为止尝试过什么? –

+0

您指向的文章建议转到报告门户并添加新角色。这正是我想要避免的:让客户做任何手动工作 – Mark

回答

0

你的问题有点不清楚。这听起来像你不知道为什么你会收到权限错误。答案是你需要创建一个新的角色。我假设(在您的评论后),您的问题是如何使用C#做到这一点。

您可以使用CreateRole() method,它仅适用于SSRS本机模式。如果SSRS安装在SharePoint集成模式下,除了使用UI之外,不存在任何支持的方法。

This method throws an OperationNotSupportedSharePointMode exception when invoked in SharePoint mode

+0

我正在研究CreateRole()并且不确定这是我需要的。 CreateRole()创建新角色而不将其与用户/组相关联。但在我的情况下,我需要将用户的NT AUTHORITY \ NETWORK SERVICE添加到主文件夹并为其提供角色。这就是你指出的文章所描述的。有一个方法SetPolices(),但似乎它将一个用户/组添加到特定的报告中,但我想在整个报告门户中添加“NT AUTHORITY \ NETWORK SERVICE”。至少,这就是我的理解。 – Mark