I have a custom content type, inheriting from the WorkflowTask content type. I've configured the content type to point to a custom form, but the URLs are not working properly.
<ContentType
ID="0x01080100E6578EE7F3CD4BCA8C6EA42C8FF3F24B"
Name="Custom Task Content Type"
Group="Custom Content Types"
Description=""
Inherits="TRUE"
Version="0"
Overwrite="TRUE"
>
<FieldRefs>
<FieldRef ID="{5E9EDA01-AFAF-4c6d-A3C4-A44C8418E519}" Name="_ApprovalNotes"/>
<FieldRef ID="{886F1812-47CE-4cd7-AF93-C57EF5EBD171}" Name="_ApprovalStatus"/>
<FieldRef ID="{CFB3DE92-106B-4c3e-84D2-9FBC3A3C5921}" Name="_Delegate"/>
<FieldRef ID="{B923E7D6-7C56-447b-95A9-5CFB7854F7B7}" Name="_taskType"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormUrls>
<New>_Layouts/project/custom Form.aspx?PageMode=New&WFTask=1</New>
<Edit>_Layouts/project/custom Form.aspx?PageMode=Edit&WFTask=1</Edit>
<Display>_Layouts/project/custom Form.aspx?PageMode=Display&WFTask=1</Display>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>
When adding this content type to the built-in Tasks list, the custom form URLs are not carried over. So in the FeatureActivated event receiver, I have this code:
SPContentType ct = taskList.ParentWeb.AvailableContentTypes[contentTypeName];
if (ct != null)
{
taskList.ContentTypes.Add(ct);
taskList.Update();
SPContentType ct2 = taskList.ContentTypes[contentTypeName];
ct2.NewFormUrl = "_Layouts/project/custom Form.aspx?PageMode=New&WFTask=1";
ct2.EditFormUrl = "_Layouts/project/custom Form.aspx?PageMode=Edit&WFTask=1";
ct2.DisplayFormUrl = "_Layouts/project/custom Form.aspx?PageMode=Display&WFTask=1";
ct2.Update();
}
Unfortunately, when I open the workflow task form, the received query string contains the key amp;WFTask rather than WFTask. Why is the ampersand XML encoded and then directly used in the querystring rather than being decoded back to a proper ampersand? How do I fix this?