2017-10-20 109 views
0

我想我的Reportingservices2010 SOAP APISSRS CreateFolder C#命令中的错误?

测试场景是我试图创建一个文件夹中遇到的错误在CreateFolder命令(名为销售仪表)在同一父文件夹(可以让说销售)作为报告也被称为销售仪表板

当文件夹尚不存在时,命令用“AlreadyExists”异常完成。它看起来像该方法不检查目录项目类型。

这里是我的代码:

public static void createFolders(string targetURL, string folderName, string parentPath, string description, string visible) 
    { 
     //Build Authentication 
     ReportingService2010 rs = new ReportingService2010(); 
     rs.Credentials = System.Net.CredentialCache.DefaultCredentials; 
     rs.Url = targetURL; 

     //Declare properties 
     Property descriptionProp = new Property(); 
     Property visibleProp = new Property(); 
     Property[] props = new Property[2]; 

     descriptionProp.Name = "Description"; 
     descriptionProp.Value = description; 
     visibleProp.Name = "Visible"; 
     visibleProp.Value = visible; 
     props[0] = descriptionProp; 
     props[1] = visibleProp; 

     try 
     { 
      rs.CreateFolder(folderName, parentPath, props); 
     } 
     catch(Exception ex) 
     { 
      if(ex.Message.Contains("AlreadyExists")) 
      { 
       //do nothing? 
      } 
      else 
      { 
       throw; 
      } 
     } 
    } 

我想看看我是否能有助于修复,但没有GitHub库为C#SSRS的东西。任何想法都是解决方法?

+0

您是否使用报告管理器创建文件夹? – newGuy

+0

@newGuy不,我正在用上面的c#代码创建文件夹。 gui不受影响。这看起来像RS'CreateFolder'方法中的错误 – CPorteous

+0

这不是一个错误。这很正常。那些*不是*磁盘文件夹,它们是* URL *。你*不能*具有相同的URL引用不同类型的资源。 URL'Sales%20Dashboard'不能同时引用“文件夹”*和*报告。只*不*使用相同的名字 –

回答

1

API正在返回正确的错误,因为这是Reporting Services的一般限制:同一文件夹中的项目必须具有唯一的名称(不管项目类型)。

+0

感谢Riccardo,我只是测试了这一点,我也无法手动创建这些。我感觉这是可能的。谢谢(你的)信息。 – CPorteous