Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a publishing web with unique permissions. I have tried changing the default approvers group through code by doing the follwing:

  1. Locate Pages list
  2. Locate workflow association by list.DefaultContentApprovalWorkflowId
  3. Update AssociationData and change DisplayName and AccountId to "CustomApprovers" (which is a sharepoint group.
  4. Call list.WorkflowAssociations.Update with the association.

It seems to work fine until I try to submit a page for approval. Sharepoint shows the "Processing" page, but when it completes the page is always discarded. It also does not add a task to the approval task list. Why does this happen? Am I missing a step?

Things I've tried:

  • Change it to a group that does not exist: Validation error when submitting.
  • Change AccountId to the group id: Validation error when submitting.
  • Change the AccountType to SpGroup: Page is automatically discarded.
  • Not change anything (use default settings): Page is submitted correctly.
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The reason it did not work was because I was manipulating the AssociationData using XDocument. When I dumped the xml back into the string it attached

<?xml version="1.0" encoding="utf-16">

at the top which in turn caused the xml to be rejected in some weird way. Doing a regular string replace worked just fine.

share|improve this answer
    
Also doing XDocument.ToString() would work as it does not write the <xml> declaration. –  Thomas Oct 24 '12 at 8:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.