SharePoint - 通过 CAML 配置 url 属性?
我在 SharePoint/CAML 中缺少以下问题的解决方案吗?请注意,我将给出在重定向页面(发布功能内容类型)上使用 URL 的具体示例,但该问题的范围比配置重定向页面更广泛。这确实是一个可以设置“URL”字段/属性的地方(Web 部件、页面等)的问题。
与大多数 SharePoint 开发人员一样,我有一组环境:“DEV”、“QA”、“STAGING”和“PROD”。我在每个环境中都有一些“区域设置”特定站点:
www.mysite.com us.mysite.com uk.mysite.com 等等...
每个环境中的站点(PROD 除外)都有一个与其关联的环境前缀,例如:
us.dev.mysite.com us.qa.mysite.com us.staging.mysite.com
可能是一个非常常见的设置...
我需要将用户重定向到仅存在于每个区域设置特定站点的“www”站点上的页面。我需要重定向将用户重定向到适合他们当前所处环境的“www”站点。例如,如果我在英国语言环境的开发中,并且我访问重定向页面,我应该被重定向到 www 开发站点。
我希望使用 SharePoint 中的“重定向页面”来完成此任务。我打算设置一个功能(带有模块元素)来提供“重定向页面”内容类型的实例。这允许我指定一个将用户重定向到的 URL。但是,如果我通过 CAML 配置页面,我需要一种方法来确保重定向适合指定的环境。我无法相信自己或其他开发人员会在每次构建 wsp 并将其部署到每个环境时记住更改 URL。
在指定字段/属性值时,SharePoint/CAML 是否可以根据某些开关进行某种标记替换?
Is there a solution to the following that I am missing in SharePoint/CAML. Note that I'll give a specific example of using a URL on a Redirect Page (publishing feature content type), but the issue is broader in scope than provisioning a Redirect Page. It is really a question anywhere a "URL" field/property can be set (web parts, pages, etc).
Like most SharePoint developers, I have a set of environments: "DEV", "QA", "STAGING", and "PROD". I have a few "locale" specific sites in each environment:
www.mysite.com
us.mysite.com
uk.mysite.com
etc...
Sites in each environment, other than PROD, have an environment prefix associated with them, for example:
us.dev.mysite.com
us.qa.mysite.com
us.staging.mysite.com
Probably a pretty common setup...
I have a need to redirect users to a page that only exists on the "www" site from each of the locale specific sites. I need the redirect to redirect users to appropriate "www" site for the environment they are currently in. For example, if I am in dev in the uk locale, and I visit the redirect page, I should be redirected to the www dev site.
I was hoping to use a "Redirect Page" from SharePoint to accomplish this. I was going to setup a feature (with module elements) to provision an instance of the "Redirect Page" content type. This allows me to specify a url to redirect users to. If I am provisioning the page through CAML, however, I need a way to ensure the redirect is appropriate for the environment being specified. I cannot trust myself, or other devs, to remember to change the URL each time we build and deploy the wsp to each environment.
Is there anyway in SharePoint/CAML to do some sort of token replacement based on some switch when specifying field/property values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我完全理解您的要求,但对于环境的变化(开发、质量保证、暂存、生产),我会使用 Chris O'Brien 的“配置存储”功能:
http://www.sharepointnutsandbolts.com/2008/ 05/introducing-sharepoint-config-store-for.html
这将创建一个简单的列表,您可以在其中存储特定于当前环境的信息。
这与 Gary Lapointe 的 stsadm 扩展相结合:
http://stsadm.blogspot.com/2007/08/stsadm-commands_09。 html
您可以使用它将每个环境的正确值推送到您的“配置存储”,并在代码中查询“配置存储列表”以获取环境值。
对于代表不同国家/地区的网站,您可以在该网站/网站集/网站的区域设置属性上更改它们。这增加了检查代码的另一个维度。
在您的情况下,您可能在配置存储中有一个名为“MyPrefixUrl”的条目,并调用其值+相对路径将用户重定向到正确的位置。
希望这不会让您感到困惑。
I'm not sure I understand you requirements entirely, but for the variance of environments (Dev, QA, Staging, Prod), I would use Chris O'Brien's 'Config Store' feature:
http://www.sharepointnutsandbolts.com/2008/05/introducing-sharepoint-config-store-for.html
This will create a simple list where you can store infomation specific to the current environement.
This combined with Gary Lapointe's stsadm extentions:
http://stsadm.blogspot.com/2007/08/stsadm-commands_09.html
You can use this to push out the correct values per environment to your 'Config Store' and in your code, query the 'config store list' for the environment value.
For sites that represent different countries, you can vary them on the regional settings property for that site/site collection/web. This adds another dimension to check in your code.
In your case, you may have entry in the config store called 'MyPrefixUrl' and call its value + relative path to redirect the user to the correct place.
Hope this doesn't confuse you.