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开发者_Go百科|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
I used the following syntax and it worked fine:
$spListItem["RoutingConditions"] ='<Conditions><Condition Column="9ce114d1-0f9d-4825-8a74-a9fc891723c2|ProjectId|Project Id" Operator="IsEqual" Value="123456" /></Conditions>'
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.
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.
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
精彩评论