Application Insights Multi-Step Availability Test Producing 411 - azure

I have created a WebTest via Fiddler which POST's to a public endpoint using the basic Authorization method. The call works fine in Fiddler/Postman however when I upload the following webtest as an Azure's Availablity test it fails, giving me a 411 error.
The Web Test:
<?xml version="1.0" encoding="utf-8"?>
<TestCase Name="FiddlerGeneratedWebTest" Id="" Owner="" Description="" Priority="0" Enabled="True" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="" RequestCallbackClass="" TestCaseCallbackClass="">
<Items>
<Request Method="POST" Version="1.1" Url="https://myapp.scm.azurewebsites.net/api/triggeredwebjobs/mywebjob/run" ThinkTime="0" Timeout="60" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8">
<Headers>
<Header Name="Authorization" Value="Basic JGRldi1sb2NhbGl0eS13ZWItam9iphYVJSN1o0QjlmUXBNZlhjcXJKSHd1RFpYNW1xWlE4MTNzRnRMMUpOc2JFNXVna3l2aWVhQ3pBNXJvYzg=" />
<Header Name="Content-Length" Value="0" />
</Headers>
<QueryStringParameters>
<QueryStringParameter Name="arguments" Value="health" UrlEncode="True" UseToGroupResults="False" />
</QueryStringParameters>
</Request>
</Items>
</TestCase>
The Error
Returned once the availability test fails:
> 1 primary requests, 0 dependant requests and 0 conditional rules failed
> Http Error (subtype '411 - LengthRequired') occured at 09/06/2018
> 05:49:45 (UTC) for Uri
> 'https://myapp.scm.azurewebsites.net/api/triggeredwebjobs/mywebjob/run?arguments=health',
> step #1 with the error '411 - LengthRequired'.
Any help would be greatly appreciated!

Related

Using the SharePoint REST API to update a list item

I am attempting to update a list item using the SharePoint REST API but am encountering the following error:
<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.SharePoint.Client.InvalidClientQueryException</m:code>
<m:message xml:lang="en-US">The expression "web/lists/GetByTitle('Drop Off Library')/items("http:/example.com/_api/Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')")" is not valid.</m:message>
</m:error>
After adding the file, I receive the following response:
<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="http://example.com/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://example.com/_api/Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')</id>
<category term="SP.File" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Author" type="application/atom+xml;type=entry" title="Author" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/Author" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CheckedOutByUser" type="application/atom+xml;type=entry" title="CheckedOutByUser" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/CheckedOutByUser" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/EffectiveInformationRightsManagementSettings" type="application/atom+xml;type=entry" title="EffectiveInformationRightsManagementSettings" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/EffectiveInformationRightsManagementSettings" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/InformationRightsManagementSettings" type="application/atom+xml;type=entry" title="InformationRightsManagementSettings" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/InformationRightsManagementSettings" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/ListItemAllFields" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/LockedByUser" type="application/atom+xml;type=entry" title="LockedByUser" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/LockedByUser" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" type="application/atom+xml;type=entry" title="ModifiedBy" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/ModifiedBy" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/Properties" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Versions" type="application/atom+xml;type=feed" title="Versions" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/Versions" />
<title />
<updated>2019-01-11T14:47:13Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:CheckInComment></d:CheckInComment>
<d:CheckOutType m:type="Edm.Int32">0</d:CheckOutType>
<d:ContentTag>{2BDD4E2D-79C8-4F6B-8DD7-AC745D9360A8},1,1</d:ContentTag>
<d:CustomizedPageStatus m:type="Edm.Int32">0</d:CustomizedPageStatus>
<d:ETag>"{2BDD4E2D-79C8-4F6B-8DD7-AC745D9360A8},1"</d:ETag>
<d:Exists m:type="Edm.Boolean">true</d:Exists>
<d:IrmEnabled m:type="Edm.Boolean">false</d:IrmEnabled>
<d:Length m:type="Edm.Int64">4</d:Length>
<d:Level m:type="Edm.Byte">255</d:Level>
<d:LinkingUrl></d:LinkingUrl>
<d:MajorVersion m:type="Edm.Int32">1</d:MajorVersion>
<d:MinorVersion m:type="Edm.Int32">0</d:MinorVersion>
<d:Name>b.txt</d:Name>
<d:ServerRelativeUrl>/DropOffLibrary/b.txt</d:ServerRelativeUrl>
<d:TimeCreated m:type="Edm.DateTime">2019-01-11T14:47:13Z</d:TimeCreated>
<d:TimeLastModified m:type="Edm.DateTime">2019-01-11T14:47:13Z</d:TimeLastModified>
<d:Title m:null="true" />
<d:UIVersion m:type="Edm.Int32">512</d:UIVersion>
<d:UIVersionLabel>1.0</d:UIVersionLabel>
<d:UniqueId m:type="Edm.Guid">2bdd4e2d-79c8-4f6b-8dd7-ac745d9360a8</d:UniqueId>
</m:properties>
</content>
</entry>
My assumption here is that the item id is either the value of the <id> tag or the value of the <UniqueId> tag, but neither have worked.
First you should set Accept header to application/json for your request so the result will be a bit better to read.
Item ID is an incremental integer in the library. You can add column ID to a view in the library to see the value for each file. From some reason this ID is missing in the response you get when the file is uploaded.
To get item by ID (best option) use:
/_api/web/lists/getByTitle('Drop Off Library')/items(1)
To get item by server relative url (also fine option) use:
/_api/web/getFileByServerRelativeUrl('/DropOffLibrary/b.txt')
UniqueId is a guid which cannot be easily used for querying the item. You would have to use $filter parameter, but it is not optimal due to performace impact.
/_api/web/lists/getByTitle('Drop Off Library')/items?$filter=GUID eq guid'2bdd4e2d-79c8-4f6b-8dd7-ac745d9360a8'

Check security header in Mule http:listener

I have a need to check some security HTTP header (called for example X-MyApp-Security) value before processing it after Mule http:listener. Header should be checked like basic auth header but more simply.
I found some Mule documentation about this but don't understand how to use it my simple flow:
<http:listener-config name="HTTP_Listener_Configuration" host="${httpServer.host}" port="${httpServer.port}" doc:name="HTTP Listener Configuration" />
<flow name="planadoWebhookFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP" allowedMethods="POST"/>
<set-payload value="Hello from security area!" doc:name="Set Payload"/>
</flow>
Please help me with header authentication in Mule 3.7.
You can use the "http:basic-security-filter" element, here you have an example:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:ftp="http://www.mulesoft.org/schema/mule/ftp"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:mule-xml="http://www.mulesoft.org/schema/mule/xml"
xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:ws="http://www.mulesoft.org/schema/mule/ws"
xmlns:smtps="http://www.mulesoft.org/schema/mule/smtps"
xmlns:email="http://www.mulesoft.org/schema/mule/email"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ftp http://www.mulesoft.org/schema/mule/ftp/current/mule-ftp.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/jersey http://www.mulesoft.org/schema/mule/jersey/current/mule-jersey.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd
http://www.mulesoft.org/schema/mule/smtps http://www.mulesoft.org/schema/mule/smtps/current/mule-smtps.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.1/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
">
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="user" password="password" authorities="ROLE_ADMIN" />
<ss:user name="anon" password="anon" authorities="ROLE_ANON" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="memory-provider" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9091" doc:name="HTTP Listener Configuration"/>
<flow name="testingFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/*" doc:name="HTTP"/>
<logger message="Before Authentication" level="INFO" doc:name="Log Failure"/>
<http:basic-security-filter realm="mule-realm"/>
<logger message="After Authentication" level="INFO" doc:name="Log Failure"/>
</flow>
</mule>
You can find more information in the next link:
https://docs.mulesoft.com/mule-user-guide/v/3.7/http-listener-connector#authentication

Apigee OPTIONS 404

I have been stumped by Apigee's CORS support. I setup a new proxy and made sure to tick the " Enable Direct Browser Access for Your API — Allow direct requests from a browser via CORS." box.
It appears that CORS is working for the normal GET requests, however pre-flight OPTIONS requests are not found and are returning a 404. I found this answer but was not able to resolve my problem because it seems like a different problem perhaps?
The main question I would like answered is how do I setup Access-Control-Allow-Origin=* for all requests? Even OPTIONS requests?
Proxy Endpoints
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
<Description/>
<Flows>
<Flow name="Forecast">
<Description/>
<Request/>
<Response/>
<Condition>(proxy.pathsuffix MatchesPath "/forecast") and (request.verb = "GET")</Condition>
</Flow>
</Flows>
<PreFlow name="PreFlow">
<Request/>
<Response/>
</PreFlow>
<HTTPProxyConnection>
<BasePath>/v1/weather</BasePath>
<VirtualHost>default</VirtualHost>
<VirtualHost>secure</VirtualHost>
</HTTPProxyConnection>
<RouteRule name="default">
<TargetEndpoint>default</TargetEndpoint>
</RouteRule>
<PostFlow name="PostFlow">
<Request/>
<Response/>
</PostFlow>
</ProxyEndpoint>
Target Endpoints
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="default">
<Description/>
<Flows>
<Flow name="OptionsCORS">
<Description/>
<Request/>
<Response>
<Step>
<Name>CrossOriginResourceSharing</Name>
</Step>
</Response>
<Condition>request.verb equals "OPTIONS"</Condition>
</Flow>
</Flows>
<PreFlow name="PreFlow">
<Request/>
<Response>
<Step>
<Name>CrossOriginResourceSharing</Name>
</Step>
</Response>
</PreFlow>
<HTTPTargetConnection>
<URL>https://home.nest.com/api/0.1/weather</URL>
</HTTPTargetConnection>
<PostFlow name="PostFlow">
<Request/>
<Response/>
</PostFlow>
</TargetEndpoint>
Add CORS File
<AssignMessage async="false" continueOnError="false" enabled="true" name="CrossOriginResourceSharing">
<DisplayName>Add CORS</DisplayName>
<FaultRules/>
<Properties/>
<Add>
<Headers>
<Header name="Access-Control-Allow-Origin">*</Header>
<Header name="Access-Control-Allow-Headers">origin, x-requested-with, accept</Header>
<Header name="Access-Control-Max-Age">3628800</Header>
<Header name="Access-Control-Allow-Methods">GET, PUT, POST, DELETE, OPTIONS</Header>
</Headers>
</Add>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="response"/>
</AssignMessage>
Just in case it helps- the following is the error I get when doing my request. I'm using Chrome and have an AngularJS app. I've been able to replicate the issue using a cURL statement as well
( curl -H "Origin: localhost" --verbose http://*********-prod.apigee.net/v1/weather/forecast/12345 -X OPTIONS )
{
"url": "/api/0.1/weather/forecast/73013",
"message": "404 Not Found"
}
Thanks!
In your proxy.xml you add one more flow specific to OPTIONS
<Flow name="OPTIONS">
<Description>This flow is for client side applications</Description>
<Response>
<Step>
<Name>CORSResponse</Name>
</Step>
</Response>
<Condition>(request.verb = "OPTIONS")</Condition>
<Request/>
</Flow>
Now the CORSResponse.xml Policy can be like below
<AssignMessage name="CORSResponse">
<AssignTo type="response" createNew="true" />
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<Set>
<Headers>
<Header name="Access-Control-Allow-Origin">yourdomain.com</Header>
<Header name="Access-Control-Allow-Headers">origin, x-requested-with, x-source-ip, Accept, Authorization, User-Agent, Host, Accept-Language, Location, Referer</Header>
<Header name="Access-Control-Allow-Methods">GET, POST</Header>
</Headers>
<StatusCode>200</StatusCode>
</Set>
</AssignMessage>
The solution was to add a RouteRule that prevented the request from passing through to my API on OPTIONS requests.
<RouteRule name="NoRoute">
<Condition>request.verb == "OPTIONS"</Condition>
</RouteRule>
Additionally I added a flow that added CORS support to the response
<Flow name="OptionsPreFlight">
<Request/>
<Response>
<Step>
<Name>Add-CORS</Name>
</Step>
</Response>
<Condition>request.verb == "OPTIONS"</Condition>
</Flow>
And my Final Add-CORS policy
<AssignMessage async="false" continueOnError="false" enabled="true" name="Add-CORS">
<DisplayName>Add CORS</DisplayName>
<FaultRules/>
<Properties/>
<Add>
<Headers>
<Header name="Access-Control-Allow-Origin">*</Header>
<Header name="Access-Control-Allow-Headers">origin, x-requested-with, accept</Header>
<Header name="Access-Control-Max-Age">3628800</Header>
<Header name="Access-Control-Allow-Methods">GET, PUT, POST, DELETE</Header>
</Headers>
</Add>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="response"/>
</AssignMessage>

CC Validator throws error for dashboard.config file - No loaded type is marked up with a Reflector Type attribute

Think I have messed up the config file for the dashboard.
Error -
No loaded type is marked up with a Reflector Type attribute that matches the XML node(dashboard).
Error comes up when I validate the dashboard.config file in the CC Validator.
This is my dashboard.config file
<?xml version="1.0" encoding="utf-8"?>
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<dashboard>
<remoteServices>
<servers>
<!-- Update this list to include all the servers you want to connect to. NB - each server name must be unique -->
<server name="local" url="tcp://localhost:21234/CruiseManager.rem" allowForceBuild="true" allowStartStopBuild="true" backwardsCompatible="false" />
</servers>
</remoteServices>
<plugins>
<farmPlugins>
<farmReportFarmPlugin categories="false" />
<cctrayDownloadPlugin />
<administrationPlugin password="" />
</farmPlugins>
<serverPlugins>
<serverReportServerPlugin />
</serverPlugins>
<projectPlugins>
<projectReportProjectPlugin />
<viewProjectStatusPlugin />
<latestBuildReportProjectPlugin />
<viewAllBuildsProjectPlugin />
</projectPlugins>
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<buildLogBuildPlugin />
</buildPlugins>
<securityPlugins>
<simpleSecurity />
</securityPlugins>
</plugins>
</dashboard>
</cruisecontrol>
Can anyone please help me on this, and also some tips on how to resolve similar issues would be helpful.
Your dashboard.config file looks a little strange, i dont think it should contain the cruisecontrol node.
I think it should be:
<?xml version="1.0" encoding="utf-8"?>
<dashboard>
<remoteServices>
<servers>
<!-- Update this list to include all the servers you want to connect to. NB - each server name must be unique -->
<server name="local" url="tcp://localhost:21234/CruiseManager.rem" allowForceBuild="true" allowStartStopBuild="true" backwardsCompatible="false" />
</servers>
</remoteServices>
<plugins>
<farmPlugins>
<farmReportFarmPlugin categories="false" />
<cctrayDownloadPlugin />
<administrationPlugin password="" />
</farmPlugins>
<serverPlugins>
<serverReportServerPlugin />
</serverPlugins>
<projectPlugins>
<projectReportProjectPlugin />
<viewProjectStatusPlugin />
<latestBuildReportProjectPlugin />
<viewAllBuildsProjectPlugin />
</projectPlugins>
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<buildLogBuildPlugin />
</buildPlugins>
<securityPlugins>
<simpleSecurity />
</securityPlugins>
</plugins>
</dashboard>

XmlDocuments Element ignored in Content Type?

I have a content type defined in Elements.xml and I want to add an Event Receiver. My Elements.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Announcement (0x0104) -->
<ContentType ID="0x0104008a424de98660457481eb7d8ddb5161ee"
Name="News Posting"
Group="News"
Description="$Resources:NewsCTypeDescription"
Inherits="TRUE"
Version="1"
Sealed="TRUE"
>
<FieldRefs>
<FieldRef ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Name="NewsExcerpt"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>ItemAdded</Name>
<Type>ItemAdded</Type>
<Class>MyAssembly.NewsItemEventReceiver</Class>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<SequenceNumber>10000</SequenceNumber>
<Synchronization>Synchronous</Synchronization>
<Data />
<Filter />
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
The weird thing is that the Event Receiver never executes. I've checked the Schema with SharePoint Manager 2010, and it seems that the XmlDocuments element is ignored completely?
Here's the content type SchemaXml according to SharePoint Manager:
<?xml version="1.0" encoding="utf-16"?>
<ContentType ID="0x0104008A424DE98660457481EB7D8DDB5161EE" Name="News Posting" Group="News" Description="A News Posting" Sealed="TRUE" Version="1">
<Folder TargetName="_cts/News Posting" />
<Fields>
<Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentType" Group="_Hidden" Type="Computed" DisplayName="Content Type" Sealed="TRUE" Sortable="FALSE" RenderXMLUsingPattern="TRUE" PITarget="MicrosoftWindowsSharePointServices" PIAttribute="ContentTypeID" Customization="">
<FieldRefs>
<FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId" />
</FieldRefs>
<DisplayPattern>
<MapToContentType>
<Column Name="ContentTypeId" />
</MapToContentType>
</DisplayPattern>
</Field>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" Group="_Hidden" Type="Text" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" Customization="" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
<Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body" Group="_Hidden" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" DisplayName="Body" Sortable="FALSE" NumLines="15" Customization="" />
<Field ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Name="Expires" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Expires" Group="_Hidden" Type="DateTime" DisplayName="Expires" Format="DateOnly" Customization="" />
<Field ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Group="News" Name="NewsExcerpt" DisplayName="Excerpt of the Article" Description="165 Characters maximum" MaxLength="165" Type="Text" Customization="" />
</Field>
</Fields>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
</ContentType>
I have tried adding a FormTemplates XmlDocument as well, just to see if that works, but even this is ignored (I've changed the ListForm to ListForm2, but the SchemaXml is unchanged.
I've deleted the entire Web Application and Content Database to make sure there was nothing stale/stuck, but the result is still the same.
Is XmlDocuments depreciated in SharePoint 2010? What are the alternatives?
You should add your event receiver as a feature, maybe even as a part of the same feature that installs the content type. We always do it this way and it works perfectly

Resources