1

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

user574204
  • 33
  • 2
  • 11

4 Answers4

1

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>'
Siddharth Rout
  • 147,039
  • 17
  • 206
  • 250
Shehzad
  • 11
  • 1
0

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.

willfg
  • 1
  • 1
  • Thanks for the response willfg - Indeed have tried 'Equal' both cases but no dice. Funnily enough that was the same page I used aswell to build my rule. Yes I'm building the rules programmatically but need to ensure the syntax for the condition is correct to start. It would be useful to know where the rules get stored after they get created from the UI. – user574204 Jan 13 '11 at 13:43
  • It is stored in "Content Organiser Rules" (hidden). What you might be able to try is to generate a rule via the UI then access it using powershell: $web = get-spweb(); $list = get-splist("Content Organizer Rules"); $list.item[0]. – willfg Jan 13 '11 at 14:15
0

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.

willfg
  • 1
  • 1
  • 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 – user574204 Jan 13 '11 at 19:56
0

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

user574204
  • 33
  • 2
  • 11