Sharepoint 2010 内容组织器条件字符串 xml
我正在与 Sharepoint 2010 内容管理器合作并以编程方式设置条件属性。
它是 EcmDocumentRouterRule.ConditionsString 属性,它接受以下 xml 片段的字符串表示形式:
<Conditions><Condition Column='F38E4008-F1C7-476C-8FB1-17C0A363D16B|Crisp Name|Crisp Name' Operator='Equals' Value='quavers' /></Conditions>
我有一个内容类型,其中包含名为“Crisp Name”的列。当其值为“颤动”时,它应该执行一些操作。 我认为问题在于获得正确的运算符值,但我不知道应该使用哪一个。内容管理器规则已成功创建,但当我尝试在 Sharepoint 中编辑它时,出现运行时错误。如果我从代码中删除此条件,我就可以按预期在 Sharepoint 中查看和编辑规则。我需要使用 Equals 的条件,尝试了一些变体,包括“==”和“Eq”,但不确定这里缺少什么。
这是一个非常紧迫的要求,任何帮助将不胜感激
I’m working with the Sharepoint 2010 Content organiser and setting the conditions property programmatically.
It's the EcmDocumentRouterRule.ConditionsString property which accepts a string representation of the following xml fragment:
<Conditions><Condition Column='F38E4008-F1C7-476C-8FB1-17C0A363D16B|Crisp Name|Crisp Name' Operator='Equals' Value='quavers' /></Conditions>
I have a Content Type with column called 'Crisp Name'. When its value is ‘quavers’ it should carry out some action.
I think the issue is getting the right operator value, but I don't know which one should be used. The Content Organiser rule gets created successfully but when I try and edit it in Sharepoint I get a runtime error. If I remove this condition from my code I am able to view and edit the rule in Sharepoint as expected. I need the condition to make use of Equals, have tried a few variations including ‘==’ and ‘Eq’ not sure what it is that’s missing here.
This is quite an urgent requirement any help would be greatly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我使用了以下语法并且运行良好:
I used the following syntax and it worked fine:
您是否尝试过不带 s 的“等于”?我明白这可能是一个微不足道的建议。这似乎在这里暗示但没有明确说明:
http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.ecmdocumentrouterrule.aspx
您是否以编程方式自行创建规则?我目前正在尝试执行此操作,它们成功出现在列表中,但只有当我通过用户界面再次保存它们时才有效。
Have you tried "Equal" without the s? I appreciate that might be rather a trivial suggestion. That seems to be hinted at here but not stated explicitly:
http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.ecmdocumentrouterrule.aspx
Are you creating the rules themselves programmatically? I am attempting to do this at the moment and they appear successfully in the list but only work if I then save them again via the UI.
找到了,你想要“IsEqual”。如所述,通过使用 powershell 访问列表项来完成此操作。
$web = get-spweb(weburl);
$list = $web.lists["内容组织者规则"];
$list.items[0] >>> c:\arule.txt
然后您可以在文件中查找条件。
Found it, you want "IsEqual". Did this by accessing list item using powershell as described.
$web = get-spweb(weburl);
$list = $web.lists["Content Organizer Rules"];
$list.items[0] >> c:\arule.txt
You can then look in the file for the condition.
感谢您提供有用的信息以供参考。然而,在再次单步执行操作后,但在具有新内容类型、新列的新网站集上,事实证明我的问题与列功能 ID 的区分大小写有关 - 它需要小写。我尝试了“Equal”和“IsEqual”,两者都正确添加了条件。在这两种情况下,我都可以通过 UI 查看和编辑规则。感谢您抽出宝贵的时间,非常感谢
Thanks for that willfg useful to know for reference. However after stepping through things again but on a fresh site collection with fresh content type, fresh column, it turned out my issue was to do with case sensitivity on the column feature id - it needs to be lower case. I tried 'Equal' and 'IsEqual' and both added the condition correctly. I was able to view and edit the rule through the UI in both cases. Thanks for your time though much appreciated