Cannot Automatically Download File Attachment After Update Rollup 7
- Update Rollup 7 appears to have introduced a new RPC Security Token that is sends when requesting attachment downloads. There is example code in the CRM SDK that shows how to automatically download a specific CRM attachment, but no longer works now because of the new token.Naturally, we have implemented this SDK code in a number of customizations and need to know how to make it compatible with Update Rollup 7. How can request an RPC Token to include in the download attachment function?
Answers
- I reckon that any occasional cases of this working on UR7 are due to caching, as it looks to me like UR 7 properly breaks this functionality.
However, there is a registry value that can turn off token checking, and hence fixes it. See http://mscrmuk.blogspot.com/2009/11/ur-7-breaks-attachment-download-code.html for details.
As to a proper code fix, the CRM product team, and the SDK team are aware of the problem, and I'd hope they undo this change (my view is it makes CRM implementations less secure, as people apply the registry change), though the earliest that I'd envision something happen would be UR8
Microsoft CRM MVP - http://mscrmuk.blogspot.com http://www.excitation.co.uk- Marked As Answer byJim Glass MSFTOwnerFriday, November 06, 2009 6:41 PM
All Replies
Hello Developers,
We are aware of this issue. The security fix was introduced on in UR7 to prevent Cross-Site request forgery attacks on the CRM servers. Unfortunately, what it does is break every ISV and partner that needs to download attachments because there is no programmatic way to create WRPC tokens in a supported manner. We are working in a fix to resolve this issue.
Thank you,
Best regards,
Don Chang
Partner Online Technical Community
-----------------------------------------------------------------------------------------
We hope you get value from our new forums platform! Tell us what you think:
http://social.microsoft.com/Forums/en-US/partnerfdbk/threads
------------------------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.- Proposed As Answer byDavidBerry Wednesday, November 04, 2009 5:30 PM
- I also did a update rollup 7 and now i cannot access my uploaded attachments.
http://afccinc.com?siteref=msdn - Hey,For no reason at all it is working now.
http://afccinc.com?siteref=msdn - G'day All,
We've just upgraded to Rollup 7 (on advice from Microsoft!) and encountered this same issue.
It seems to work fine from the server itself if one uses the localhost address...
Any timeframe on getting a fix for this?
Paul J. - I reckon that any occasional cases of this working on UR7 are due to caching, as it looks to me like UR 7 properly breaks this functionality.
However, there is a registry value that can turn off token checking, and hence fixes it. See http://mscrmuk.blogspot.com/2009/11/ur-7-breaks-attachment-download-code.html for details.
As to a proper code fix, the CRM product team, and the SDK team are aware of the problem, and I'd hope they undo this change (my view is it makes CRM implementations less secure, as people apply the registry change), though the earliest that I'd envision something happen would be UR8
Microsoft CRM MVP - http://mscrmuk.blogspot.com http://www.excitation.co.uk- Marked As Answer byJim Glass MSFTOwnerFriday, November 06, 2009 6:41 PM
- This problem seemed to go away for me if I used the FQDN of my CRM server
i.e.
not http://crmserver:5555
but rather http://crmserver.mydomain.com:5555
quick change to user's homepage.
sorted. Unfortunately, work-arounds or unsupported fixes won't work. We've got 100's of customers being affected by this change right now and these "solutions" won't work for many of them. I've been working with MS Support directly for almost 2 weeks now, but so far they seem clueless about how to handle it.
- Update to this issue. If you have questions, please contact CRM Support.
We recommend the following new code to address the issue you are experiencing.
For example, for Notes, the code will look like
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "<<MyOrgName>>";
CrmService service = new CrmService();
service.Url = "http://<<MyServerName>>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
annotation attachment = (annotation)service.Retrieve(EntityName.annotation.ToString(), new Guid("<<AttachmentGuid>>"), new ColumnSet(new string[] { "filename", "documentbody", "mimetype" }));
using (FileStream fileStream = new FileStream(attachment.filename, FileMode.OpenOrCreate))
{
byte[] fileContent = Convert.FromBase64String(attachment.documentbody);
fileStream.Write(fileContent, 0, fileContent.Length);
}
For salesliterature, “annotation” should be changed to “salesliterature” and “EntityName.annotation” to “EntityName.salesliterature”, everything else stays the same.
For Mail Merge Templates and Activity Mime Attachments (email attachments), “documentbody” will change to “body” and object names should change correspondingly.
SDK documentation will be updated to reflect the new code snippet.
Best regards,
Don Chang
Partner Online Technical Community
-----------------------------------------------------------------------------------------
We hope you get value from our new forums platform! Tell us what you think:
http://social.microsoft.com/Forums/en-US/partnerfdbk/threads
------------------------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.

