Report Builder 3.0 以 SharePoint 列表作为数据源,使用列表的相对 URL
我正在使用 Report Builder 3.0 创建一个在 SharePoint 2010 中使用的报表。SQL Server 2008 R2 是 SharePoint 集成模式下 Reporting Services 的后端。 Report Builder 3.0 的一项很酷的功能是使用 SharePoint 列表作为数据源,其设置非常简单 - 只需将 SharePoint 列表的 URL 作为连接字符串提供给它即可。
我最终想将此网站打包为网站模板,包括其中的报告,这意味着 URL 需要是相对的而不是绝对的。例如,而不是这样:
http://mainsite/subsite1/lists/mylist
... 我需要指定这样的内容:
mylist
... 这样,当我将其打包为站点模板并基于该模板创建新站点时,报告将使用新站点的列表而不是指向原始站点的列表 URL。我已经尝试过“mylist”、“lists/mylist”等——除了指定 subsite1/lists/mylist 之外的所有内容——但到目前为止,除了完整的 URL 之外,没有任何效果。
是否可以使用相对 URL 或其他方法,以便每次基于此网站模板创建新网站时都不必在报告中手动更改连接字符串?
编辑:我误解了数据源的连接字符串中需要包含的内容。连接字符串中的不是列表的URL,而是站点的URL。不过,该问题的概念仍然有效 - 需要动态设置指向 SharePoint 列表的数据源的连接字符串。
I'm using Report Builder 3.0 to create a report for use in SharePoint 2010. SQL Server 2008 R2 is the back end with Reporting Services in SharePoint Integrated Mode. One of the cool features of Report Builder 3.0 is the use of a SharePoint List as a data source, the setup for which is very straightforward--just give it the URL for the SharePoint List as the connection string and it works.
I eventually want to package this site as a Site Template including the report that lives in it, which means that the URL will need to be relative instead of absolute. So for example instead of this:
http://mainsite/subsite1/lists/mylist
... I need to specify something like this:
mylist
... so that when I package this as a Site Template and create a new site based on that template, the report will work with the new site's list instead of pointing back to the original site's list URL. I've tried "mylist", "lists/mylist", etc.--everything short of specifying subsite1/lists/mylist--but nothing has worked so far except for the full URL.
Is it possible to use a relative URL or some other method so that the connection string won't have to be manually changed in the report every time I create a new site based on this site template?
Edit: I misunderstood what needed to go in the data source's connection string. It's not the URL to the list but rather the URL to the site that goes in the connection string. The concept of the question remains valid though--need to dynamically set the connection string of a data source that points to a SharePoint list.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过与一些同事的集思广益后,我们找到了答案。关键是使用连接字符串的表达式。使用我原来的示例,目标是获得以下内容:
... 在连接字符串中,但无需对其进行硬编码 - 根据报告所在的位置使其动态化,以便可以将报告与网站的其余部分一起打包为网站模板。我最终得到的表达式是:
报告位于名为“Reports”的库中,因此 Globals!ReportFolder 返回:
Replace() 函数然后取出字符串的“Reports”部分,结果是连接字符串 I通缉。
需要注意的事项:
After brainstorming with some co-workers we figured it out. The key is to use an expression for the connection string. Using my original example the goal is to get this:
... in the connection string but without hardcoding it--make it dynamic based on where the report lives so the report can be packaged along with the rest of the site as a site template. The expression I ended up with is:
The report lives in a library called "Reports", so Globals!ReportFolder returns:
The Replace() function then takes out the "Reports" part of the string, and the result is the connection string I wanted.
Things to look out for: