If you haven't read about the Vista - Microsoft Dynamics CRM Search Gadget yet, please read this first: http://blogs.msdn.com/joris_kalz/pages/Vista-Microsoft-CRM-Search-Gadget.aspx
Thanks to TourismVI, there is now a solution regarding the empty value bug:
For all those struggling with the CS0103 error I have the solutione! Move the following line from default.aspx.cs up ABOVE the try block.DataRow dataRow = dataTable.NewRow();In other words that add2DataTable should function should look like this:
private static void add2DataTable(ref DataTable dataTable, BusinessEntityCollection entityCollection){ // adding records for (int i = 0; i < entityCollection.BusinessEntities.Length; i++) { DynamicEntity dynamicEntity = (DynamicEntity)entityCollection.BusinessEntities[i]; DataRow dataRow = dataTable.NewRow(); try { dataRow["type"] = dynamicEntity.Name; dataRow["id"] = ((KeyProperty)dynamicEntity.Properties[0]).Value.Value; if (((StringProperty)dynamicEntity.Properties[1]).Value != null) dataRow["field1"] = ((StringProperty)dynamicEntity.Properties[1]).Value; if (((StringProperty)dynamicEntity.Properties[2]).Value != null) dataRow["field2"] = ((StringProperty)dynamicEntity.Properties[2]).Value; if (((StringProperty)dynamicEntity.Properties[3]).Value != null) dataRow["field3"] = ((StringProperty)dynamicEntity.Properties[3]).Value; if (((StringProperty)dynamicEntity.Properties[4]).Value != null) dataRow["field4"] = ((StringProperty)dynamicEntity.Properties[4]).Value; dataTable.Rows.Add(dataRow); } catch (Exception) { if (dataRow != null && dataRow["id"] != null && dataRow["id"] != String.Empty) { dataTable.Rows.Add(dataRow); } } } }
TourismVI, thank you very much for sharing this with the community!
PingBack from http://blogs.msdn.com/joris_kalz/pages/Vista-Microsoft-CRM-Search-Gadget.aspx
Check our genric vista CRM search gadget here:
http://blogs.msdn.com/paf/archive/2009/02/20/don-t-lose-time-to-search-crm-data.aspx
Microsoft Dynamics CRM, Customer Relationship Management, Software, ASP.NET NET, Silverlight, MOSS, Office, Sharepoint, AJAX, Javascript, BizTalk, C#, WPF