BizTalk Server 2013 (CU2) could not download a file from a SharePoint 2013 document library. File was left in checked out state on SharePoint and on BizTalk Server you could read:
The Windows SharePoint Services receive adapter has failed to process the SharePoint file test.txt. The following error has been encountered:
[System.InvalidCastException] Unable to cast object of type ‘System.Collections.Generic.Dictionary`2[System.String,System.Object]’ to type ‘Microsoft.SharePoint.Client.Field’.
Error code: 12310
Once you have addressed the issue causing this problem, you can undo the check-out for this file and the adapter will try to process it again.
My colleague and I identified that the error was raised if file was downloaded from a document library having a column of Managed Metadata type. So we contacted Microsoft’s support and they pointed out that we are using wrong version of SharePoint client libraries:
- Microsoft.SharePoint.Client.dll, File version: 14.0.4762.1000
- Microsoft.SharePoint.Clinet.Runtime.dll, File version: 14.0.4762.1000
But those files came from BizTalk installation and they are referenced by the SharePoint adapter. So while Microsoft are working on the issue, you can use this workaround:
- Replace SharePoint client files located in C:\Program Files (x86)\MicrosoftBizTalk Server 2013 with their newer versions copied fromSharePoint 2013 server (file version may differ, but it should start with 15):
- Microsoft.SharePoint.Client.dll, File version: 15.0.4505.1005
- Microsoft.SharePoint.Clinet.Runtime.dll, File version: 15.0.4420.1017
- Under runtime section of BTSNTSvc.exe.config file add assembly binding redirection section
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.SharePoint.Client" publicKeyToken="71e9bce111e9429c" culture="neutral" /> <bindingRedirect oldVersion="18.104.22.168" newVersion="22.214.171.124"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.SharePoint.Client.Runtime" publicKeyToken="71e9bce111e9429c" culture="neutral" /> <bindingRedirect oldVersion="126.96.36.199" newVersion="188.8.131.52"/> </dependentAssembly> </assemblyBinding>
- And restart SharePoint host instances of BizTalk Server
Disclaimer: The workaround is not provided by Microsoft.