In Showing SharePoint document properties in Dynamics CRM views I already explained how you can adapt the standard Associated Documents view to show extra document properties from documents stored in SharePoint document libraries. In this post, I will explain how you can create new views for the SharePointDocument entity.
If you just create a new view and try to make it work out of the box you will see that this not works. You will need to export your CRM solution. You will notice that the exported zip file contains three XML files.
- solution.xml : Contains the details of the solution package including publisher information and a listing of any missing or key dependencies
- [Content_Types].xml : standard Microsoft export file that identifies the content of the solution. The [Content_Types].xml file type is part of the Open Packaging Conventions (OPC) standard. For more information, see OPC: A New Standard For Packaging Your Data on the MSDN Web site.
- customizations.xml: this file contains all of the content and mark-up that you will need to change.
Now if you look at the SavedQuery XML from the custom view which I configured in the view editor (left side of the image below), you will notice that it is quite different from the Associated Documents view that I customized previously (See Showing SharePoint document properties in Dynamics CRM views )
For a description of the different XML nodes and attributes used you can take a look at the Saved Query XML Reference but the most notable differences in the Associated Documents grid are the following – and these are also the changes that you need to make in the XML for your custom view.
SharePointDocument.RetrieveDocument– the official documentation only states that a string value is expected but not really what value is needed. For integration with SharePoint you need to specify SharePointDocument.RetrieveDocument …– defines a set of columns to return in a saved query, it seems that it is necessary to also take over a number of SharePoint specific columns. (Reference: Saved query XML reference columnsetxml ) …(Reference: Saved query XML reference layoutxml ) 0- 0 is for a normal main application view, 2 is for an associated view (Reference: Saved query XML reference querytype ) …– here you need to specify the additional SharePoint document metadata columns that you want to show in the grid
- Using SharePoint Online to store Dynamics CRM Online Documents
- Showing SharePoint document properties in Dynamics CRM views