2016-07-26 141 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