views:

1038

answers:

3

Hi

How would you suggest working with files that is stored on the note of a entity in Crm. Could you write a generic method that will enable you to access any type of file? Or would it be better to have a method for dealing with each type of file?

For example, we are going to be saving a mix of swf files and xml files on the entity, so would it make sense to have a method each for example:

  • GetXmlFilesOnAccount(accountid)
  • GetSwfFilesOnAccount(accountid)

Thanks Rihan

+1  A: 

When you upload an attachment to CRM the mimetype is also saved as part of the record information. The following link contains a nice example of how to download the attachemt using a single method. http://crmscape.blogspot.com/2009/10/ms-crm-40-sending-attachments-to.html

The post is missing the actual query needed to retrieve the annotations but you can tell what columns are required from the method signature.

+1  A: 

My suggestion using your methods:

* GetXmlFilesOnAccount(accountid)
* GetSwfFilesOnAccount(accountid)
  1. Retrieve account activitypointers by regardingobjectid(in your case accountid guid)
  2. Loop through returned activitypointers
  3. Get attachments for each activitypointer (activitypointer.activityid = activitymimeattachment.activityid)
  4. Store attachments (disk, etc)

You don't even need two methods. You can retrieve all attachment file types for a given note (annotation) with a single method.

Hope this helps.

Bes2010
A: 

Hi, To be able to download attachments without having to open windows or write custom code, consider using the Quick Attachment download at: http://www.auraaddons.com/AttachmentQuickDownload.aspx

James Willis