.NET architecture, programming tips and tricks around Microsoft technology stack - Azure, WCF Services, SQL and strategy work.
Tuesday, February 27, 2007
"Schema validation error..." while importing CRM customization file!
"A schema validation error has been detected. A schema validation error has been detected at line 21087, position 16..."
Solution -
This error shows up if you want to import a customization file which has been exported from a system which has the Update Rollup package 1 installed.
To solve the error message:-
Remove the line from the code - (these are HTML tags)
visibletoplatform 0 visibletoplatform
visibletoplatform 1 visibletoplatform
OR
Install the rollup package 1. For information and download of the package go here: http://support.microsoft.com/default.aspx/kb/922815
Thanks - Dipesh
Download SQL Server 2005 SP2 (release version)
Download SQL Server 2005 SP2
Also, check What's New in SQL Server 2005 SP2
http://download.microsoft.com/download/2/b/5/2b5e5d37-9b17-423d-bc8f-b11ecd4195b4/WhatsNewSQL2005SP2.htm
Check more on MS site - http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/servicepacks/sp2.mspx#EKB
It roughly takes an hour to install! :) Happy upgrade...
Cheers - Dipesh
Free ecourses for WCP, WCF and WF...
- Clinic 5135: Introduction to Developing with Windows® Presentation Foundation and Visual Studio® 2005
- Clinic 5136: Introduction to Developing with Windows® Workflow Foundation and Visual Studio® 2005
- Clinic 5137: Introduction to Developing with Windows® Communication Foundation and Visual Studio® 2005
- Clinic 5230: Developing Enhanced Web Experiences with Microsoft® ASP.NET AJAX Extensions
Credits: Thanks to Christopher Clark...
Cheers - DJ
Bytes - SQL 2005
Credits: Thanks to Will Green for bringing this to my attention...
Cheers - Dipesh
Looking for a free light weight XML editor?
Happy editing - Dipesh
CRM update rollup to address a number of programmability issues...
Key issues that are fixed in this update rollup -
Update Rollup 1 for Microsoft Dynamics CRM 3.0 contains fixes for the key issues that are described in the following Microsoft Knowledge Base articles:
910242 (http://support.microsoft.com/kb/910242/) You receive error messages when you try to send or promote an e-mail message in Microsoft CRM 3.0
911316 (http://support.microsoft.com/kb/911316/) Error message when you try to reply to an e-mail message in Microsoft Dynamics CRM: "An error has occurred"
911520 (http://support.microsoft.com/kb/911520/) E-mail activities are not automatically sent to the recipients when you distribute e-mail activities for a campaign in Microsoft Dynamics CRM
912061 (http://support.microsoft.com/kb/912061/) Some fields are not available as search criteria when you use Advanced Find in Microsoft Dynamics CRM 3.0
912208 (http://support.microsoft.com/kb/912208/) If you delete the contents of some of the address fields in a Microsoft Dynamics CRM sales order, the fields are not updated in Microsoft Dynamics GP
913468 (http://support.microsoft.com/kb/913468/) Error message when you try to start the Microsoft Dynamics CRM 3.0 client for Outlook: "An Error occurred loading Microsoft CRM functionality"
913549 (http://support.microsoft.com/kb/913549/) An update event does not trigger the callout function in Microsoft Dynamics CRM 3.0
915343 (http://support.microsoft.com/kb/915343/) Error message when you use Microsoft Dynamics CRM 3.0: "Buffer overrun detected!"
915791 (http://support.microsoft.com/kb/915791/) An appointment time may change when you synchronize Outlook with Microsoft Dynamics CRM 3.0
916630 (http://support.microsoft.com/kb/916630/) You can view a child entity that another user creates even if the Share relationship and the Reparent relationship are set to CascadeNone in Microsoft Dynamics CRM 3.0
917109 (http://support.microsoft.com/kb/917109/) No contacts are found if you use the Advanced Find function in Microsoft Dynamics CRM 3.0
917277 (http://support.microsoft.com/kb/917277/) You cannot view sent e-mail messages in Microsoft CRM 3.0
920763 (http://support.microsoft.com/kb/920763/) Some columns in a list view show incorrect data values if these columns have similar names in Microsoft Dynamics CRM 3.0
921653 (http://support.microsoft.com/kb/921653/) The Microsoft Dynamics CRM client for Outlook stops responding when you promote an e-mail message
Additional Issues and Complete list that got fixed with this rollup can also be found out @ http://support.microsoft.com/kb/922815/EN-US/
Hope this helps! - Dipesh
How do i access a selected record in a grid programatically in CRM 3.0?
Learn how to determine programmatically which entity records a user has selected in the Microsoft Dynamics CRM 3.0 Web application grid. Develop custom code to perform a desired operation on each entity selected in the grid.
In addition to showing you how to obtain the list of selected grid items, this article demonstrates how to develop application code which makes use of the Microsoft CRM 3.0 SDK and runs under the .NET Framework 2.0. Up until now, Microsoft CRM 3.0 SDK applications were developed to run under the .NET Framework 1.x only.
Check this atricle on msdn here:- http://msdn2.microsoft.com/en-us/library/bb267367.aspx
Download Microsoft C# and Microsoft VB.NET versions of the sample code for this article: GridSelectedItems.exe
Happy programming - Dipesh
Saturday, February 24, 2007
What if Microsoft starts making cars? :) ...(off topic!)
For all of us who feel only the deepest love and affection for the way computers have enhanced our lives, read on.
At COMDEX recently, Bill Gates reportedly compared the computer industry with the auto industry and stated, "If GM had kept up with the technology like the computer industry has, we would all be driving $25.00 cars that got 1,000 miles to the gallon."
In response to Bill's comments, General Motors issued a press release stating: If GM had developed technology like Microsoft, we would all be driving cars with the following characteristics:
1.For no reason whatsoever, your car would crash twice a day.
2.Every time they repainted the lines in the road, you would have to buy a new car.
3.Occasionally your car would die on the freeway for no reason. You would have to pull over to the side of the road, close all of the windows, shut off the car, restart it, and reopen the windows before you could continue. For some reason you would simply accept this.
4.Occasionally, executing a maneuver such as a left turn would cause your car to shut down and refuse to restart, in which case you would have to reinstall the engine.
5.Macintosh would make a car that was powered by the sun, was reliable, five times as fast and twice as easy to drive, but would run on only five percent of the roads.
6.The oil, water temperature, and alternator warning lights would all be replaced by a single "This Car Has Performed An Illegal Operation" warning light.
7.The airbag system would ask "Are you sure?" before deploying.
8.Occasionally, for no reason whatsoever, your car would lock you out and refuse to let you in until you simultaneously lifted the door handle, turned the key and grabbed hold of the radio antenna.
9.Every time a new car was introduced, car buyers would have to learn how to drive all over again, because none of the controls would operate in the same manner as the old car.
10.Oh yeah, and last but not least . . . you'd have to press the "Start" button to turn the engine off!
Cheers - D :)
Friday, February 23, 2007
Can MS SQL Server handle 1 million records per sec?
Load 1TB in less than 1 hour
OVERVIEW
This project was done using SQL Server 2005 Enterprise Edition (with SP1 beta) using the BULK INSERT command with 60 parallel input files, each of approximately 16.67 GB. The best time I got was 50 minutes. Hewlett Packard was kind enough to loan me some time one night on the machine they use to do the TPC-C tests. It is an Itanium2 Superdome with 64 1.6GHZ 9M (Madison) CPUs. For the insert tests the system was equipped with 256GB of RAM. The HP SAN configuration is rated at 14GB per second throughput. You can find the specific configurations at http://tpc.org/tpcc/results/tpcc_result_detail.asp?id=103082701. (Note: The configurations at this site may be updated periodically).
BEST PRACTICES and LESSIONS LEARNED
Here is a list of things we learned during this project that should be helpful in your projects.
Run as many load processes as you have available CPUs. If you have 32 CPUs, run 32 parallel loads. If you have 8 CPUs, run 8 parallel loads.
If you have control over the creation of your input files, make them of a size that is evenly divisible by the number of load threads you want to run in parallel. Also make sure all records belong to one partition if you want to use the switch partition strategy.
Use BULK insert instead of BCP if you are running the process on the SQL Server machine.
Use table partitioning to gain another 8-10%, but only if your input files are GUARANTEED to match your partitioning function, meaning that all records in one file must be in the same partition.
Use TABLOCK to avoid row at a time locking.
Use ROWS PER BATCH = 2500, or something near this if you are importing multiple streams into one table.
NOT FINISED YET! Check more on this blog to find out how to do test setups and other configuration steps that you need to take care of - http://blogs.msdn.com/sqlcat/archive/2006/05/19/602142.aspx
Cheers - D
Thursday, February 22, 2007
MSDN download free ... without MSDN subscription now!
Now, MSDN Library is free for download without any MSDN Subscription. It can be freely downloaded from: http://www.microsoft.com/downloads/details.aspx?FamilyID=373930cb-a3d7-4ea5-b421-dd6818dc7c41&DisplayLang=en
Happy Learning ! - Dj
MS CRM 3.0 - Coding and Testing tips...
Coding and Testing Tips -
This section contains development and testing tips that we use when working on Microsoft CRM projects. Hope you find them useful...
Microsoft .NET Framework version 2.0 versus version 1.1
Application Mode and Loader.aspx
Enabling the default Internet Explorer context menu
Accessing query string parameters
Referencing the Microsoft CRM assemblies or files
Authentication and coding with filtered views
Web.config file considerations
Server assembly impersonations
Authentication to test different users and roles
Enabling platform-level tracing
Enabling development errors
Microsoft .NET Framework Version 2.0
As documented in the SDK, Microsoft CRM 3.0 does support writing client-side code using Visual Studio .NET 2005 and the .NET Framework version 2.0 that accesses the CRMService and MetadataService Web services. However, Microsoft CRM 3.0 does not support callout or workflow assemblies written in Visual Studio .NET 2005 and the .NET Framework version 2.0. You should still continue to use Visual Studio .NET 2003 and the .NET Framework Version 1.1 when creating custom assemblies for callouts and workflow.
Please review the latest SDK for the most up-to-date information on the support for .NET Framework Version 2.0.
Application Mode and Loader.Aspx
Of course you've noticed that Microsoft CRM launches into a special Internet Explorer window that does not have the menu bar, address bar, toolbar, and so on. Microsoft CRM refers to this as the Application Mode, and it runs in this mode by default. Often, developers need these additional Internet Explorer features that application mode hides. You can launch Microsoft CRM in a standard Internet Explorer window by browsing to http://
Using the Loader.aspx page disables application mode for that single Web session. You can also permanently disable application mode for all users and all sessions by updating the Web.config file.
Disabling Application Mode
On the Microsoft CRM Web server, navigate to
Open the Web.config file in Notepad (or any text editor).
Look for the AppMode key, and change its value to Off.
Save the Web.config file.
Enabling the Default Internet Explorer Context Menu
In addition to running in Application Mode, Microsoft CRM modifies the standard Internet Explorer behavior by displaying its own context menu when you right-click in the application. Right-clicking a grid gives you options unique to Microsoft CRM, such as Open, Print, and Refresh List. However, right-clicking a form won't display a context menu like you would see on a normal Web page. When you're troubleshooting and debugging, you might find that you want to access the standard Internet Explorer context menu so that you can use features such as View Source, Properties, or Open In New Window. You can re-enable the Internet Explorer context menu by editing the Global.js file.
Re-Enabling the Internet Explorer Standard Context Menu
On the Microsoft CRM Web server, navigate to
Open the Global.js file in Notepad (or any text editor). Note: Do not double-click this file because it will attempt to execute the JavaScript file.
Right-click the file, and then click Edit.
Use your text editor's Find feature to locate the document.oncontextmenu() function.
Comment out the existing code in this function by adding /* and */ as shown in the following code. You can undo this change later by simply removing event.returnValue = true; line and the comment characters.
function document.oncontextmenu()
{
event.returnValue = true;
/*
var s = event.srcElement.tagName;
(!event.srcElement.disabled &&
(document.selection.createRange().text.length > 0
s == "TEXTAREA"
s == "INPUT" && event.srcElement.type == "text"));
*/
}
Save the file.
Open a page in Microsoft CRM and right-click it. You will see the familiar Internet Explorer context menu.
Caution Use this technique on development servers only. Do not modify the Global.js file in a production or staging environment; this unsupported change might cause unpredictable behavior. Microsoft CRM prevents use of the right-click context menu for the user's benefit and also to maintain a predictable navigation structure in the application interface.
Accessing Query String Parameters
When testing or debugging your code, you will frequently need the GUID of an entity record or want to see the query string parameters that Microsoft CRM passed to the window. You can access the URL of any page and view its GUID by pressing Ctrl+N on your keyboard. Internet Explorer opens a new window, and the address bar displays its query string parameters. You can also press the F11 key when viewing a record to toggle the display so that the URL address bar appears.
If you have re-enabled the Internet Explorer context menu, you can also get this information by right-clicking the page and selecting Properties. You can then copy the URL from the Properties dialog box.
Referencing the Microsoft CRM Assemblies or Files
You should never reference any Microsoft CRM assemblies other than Microsoft.Crm.Platform .Callout.Base.dll. You also should not import any of the JavaScript, style sheets, or behavior files into your project. Microsoft will not support this type of code reuse, and you will probably experience significant code problems when Microsoft CRM releases hotfixes, updates, or patches.
Caution Because you're not supposed to even reference any of the Microsoft CRM assemblies other than Microsoft.Crm.Platform.Callout.Base.dll, it should also be pretty obvious that you shouldn't attempt to modify any of the Microsoft CRM .dll files, either.
If you want to mimic any look or functionality of Microsoft CRM, you must re-create it yourself. The SDK provides a sample style sheet and a UI Style Guide, but if you want to review and understand the native script files, you can find most of them in <>\_common. If you want to review styles or code, copy these files to your own directory.
Authentication and Coding with Filtered Views
The SQL filtered views provide an excellent method for you to quickly and easily retrieve Microsoft CRM data by using standard SQL Server connections. However, because the filtered views rely on Integrated Windows authentication for data security, you must pay attention to how your code connects to the filtered views.
If you were to go under the hood of a filtered view in SQL and look at its script, you would see that it uses a custom function to enforce the security settings.
create function dbo.fn_FindUserGuid ()
returns uniqueidentifier
as
begin
declare @userguid uniqueidentifier
select @userguid = s.SystemUserId
from SystemUserBase s
where s.DomainName = SUSER_SNAME()
return @userguid
end
SUSER_SNAME() is a special function in SQL that returns the currently authenticated user, and the preceding function uses it to find the systemuserid identifier. If your code doesn't authenticate to SQL Server by using Windows authentication, your queries will never return any data, because all of the filtered views perform an inner join using systemuserid.
To connect to the database by using Windows authentication instead of SQL Server authentication, your connection string should include the following parameter: Integrated Security=SSPI. The full string would look something like this.
server=databaseserver;database=yourcustomdatabase;Integrated Security=SSPI
More Info Remember that you should never alter the Microsoft CRM databases by adding your own routines or stored procedures. Microsoft doesn't support this type of alteration, and it will probably result in the loss of your routines upon upgrades or hotfixes. Instead, you should create your own database to store your custom routines.
If you're calling your custom SQL routines from a Web page, you must configure additional settings to make sure that your Web page passes the integrated Windows credentials to SQL Server. First, the user should belong to the SQLAccessGroup, which will happen automatically when you add users to Microsoft CRM. Second, you must ensure that your Web application does not permit anonymous access by disabling anonymous access in IIS for your virtual directory or Web site. Finally, you must add or update the Web.config file in your custom web with the following nodes located in the
These keys ensure that IIS uses the Windows credential set when accessing a page in your virtual web.
As we explained earlier, another consequence of the integrated security features in filtered views is that you can't use filtered views in callouts or in workflow assemblies. The callout and workflow engine runs under the security context of the user, and, because you cannot impersonate to SQL Server from your connection string, you cannot retrieve data by using the filtered views. In these cases, we recommend that you use the QueryExpression class because the Web service does allow impersonation.
Web.Config File Considerations
If you create custom pages that work with Microsoft CRM, you should deploy them to a directory outside of the Microsoft CRM root and create a new Web site or a new virtual directory. The easiest way to leverage cross-site scripting (see Chapter 10 for more details) is to set up a virtual directory underneath the Microsoft CRM web. When you create a virtual directory, you will inherit the Web.config settings of the parent web, which in this case would be settings from the Microsoft CRM Web.config file.
If you add your custom web files to a virtual directory underneath the Microsoft CRM web, you might receive an error similar to this one when accessing your custom pages:
"File or assembly name Microsoft.Crm.Tools.ImportExportPublish, or one of its dependencies, was not found."
You have a couple of options for getting around this error. One is to register each of the assemblies that fail in the global assembly cache (GAC). The other is to remove these entries in your custom Web.config file. To remove the assemblies from your Web.config file, add the
Warning Make sure that you add this to your Web.config file. Do not alter these values in the Microsoft CRM Web.config file.
Server Assembly Impersonation
You might find that you need to use the credentials of the user making the request in your callouts or workflow assemblies. The SDK documents this numerous times, but, because it is such a useful technique, we want to mention here, too. This code snippet shows how to accomplish impersonation.
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://
// Get the current user ID.
WhoAmIRequest userRequest = new WhoAmIRequest();
WhoAmIResponse userResp = (WhoAmIResponse) service.Execute(userRequest);
service.CallerIdValue = new CallerId();
service.CallerIdValue.CallerGuid = userResp.UserId;
When you are using impersonation from a callout, the user context already contains the user ID for you. So, instead of making an additional request, you could simply use the following.
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://
service.CallerIdValue = new CallerId();
service.CallerIdValue.CallerGuid = userContext.UserId;
Enabling Development Errors in the Web.Config File
On the Microsoft CRM Web server, navigate to
Open the Web.config file in Notepad (or any text editor).
Look for the DevErrors key, and change its value to On.
Save the Web.config file.
Thanks to Mike Snyder and Jim Steger for writing down these tips in their book. You can refer to their book - Working with Microsoft Dynamics CRM 3.0 for more details. Thanks - D
MS CRM 3.0 - the world is talking...
Also, MS is coming up with TITAN as the latest release after ver 3.0. We will cover that as we mature :)
I have been lucky one to get a chance to work on MS CRM 3.0 a little. I have gurus around me who have vast experience on MS CRM, So probably i am going to blog more on this in coming days... as i learn more from all! Please feel free to add/edit or correct me if i go wrong anywhere. Thanks - Dipesh
Wednesday, February 21, 2007
SQL Service Broker in SQL 2005
What is service broker – It is a platform for async queued database applications... that's it :)
Steps involved to get started for SQL Service broker -
1 Create Message
2 Create Contract
3 Create Service (Sender/Receiver)
4 Create Queues
5 Assign Service to the Queue (to read queues)
6 Start a Dialog
7 Start a conversation (unique ID)
8 Send Messages
You can create Queues on same database on the same server or different servers.
You will need to create a Route specifying the Address to which the messages should be routed.
Important question though: Why messaging in database? May be the below points justify:-
1. Reliable service oriented arch
2. Parallel stored procs
3. Asynchronous triggers
4. Batch processing – Dialogs for ordering, Activation for parallelism, Distributed batch (multiple queues sitting remotely)
References –
Very good blog URL to understand SQL Service Broker - http://www.sqlservercentral.com/columnists/sSampath/anintroductiontotheservicebroker.asp
MSDN search – http://Msdn.microsoft.com/library/default.aspx – "Service broker" (tons of good information)
You can download SQL 2005 Express product to get started – http://msdn.microsoft.com/vstudio/express/sql/download/
lets get to the code to understand what we are talking about. You can follow these steps in SQL 2005--
--We will use adventure works as the sample database
USE AdventureWorks
GO
-- First, we need to create a message type. Note that our message type is
-- very simple and allowed any type of content
CREATE MESSAGE TYPE HelloMessage
VALIDATION = NONE
GO
-- Once the message type has been created, we need to create a contract
-- that specifies who can send what types of messages
CREATE CONTRACT HelloContract
(HelloMessage SENT BY INITIATOR)
GO
-- The communication is between two endpoints. Thus, we need two queues to
-- hold messages
CREATE QUEUE SenderQueue
CREATE QUEUE ReceiverQueue
GO
-- Create the required services and bind them to be above created queues
CREATE SERVICE Sender
ON QUEUE SenderQueue
CREATE SERVICE Receiver
ON QUEUE ReceiverQueue (HelloContract)
GO
-- At this point, we can begin the conversation between the two services by
-- sending messages
DECLARE @conversationHandle UNIQUEIDENTIFIER
DECLARE @message NVARCHAR(100)
BEGIN
BEGIN TRANSACTION;
BEGIN DIALOG @conversationHandle
FROM SERVICE Sender
TO SERVICE 'Receiver'
ON CONTRACT HelloContract
-- Send a message on the conversation
SET @message = N'Hello, World';
SEND ON CONVERSATION @conversationHandle
MESSAGE TYPE HelloMessage (@message)
COMMIT TRANSACTION
END
GO
-- Receive a message from the queue
RECEIVE CONVERT(NVARCHAR(max), message_body) AS message
FROM ReceiverQueue
-- Cleanup
DROP SERVICE Sender
DROP SERVICE Receiver
DROP QUEUE SenderQueue
DROP QUEUE ReceiverQueue
DROP CONTRACT HelloContract
DROP MESSAGE TYPE HelloMessage
GO
Happy learning :) - D
Thursday, February 15, 2007
Will Windows Vista support MSDE ?
Check this for SQL on Vista upgrade.. http://www.microsoft.com/sql/howtobuy/sqlonvista.mspx
Happy upgrading... - D
Wednesday, February 14, 2007
"How do i do" videos.... ASP.net AJAX
http://blogs.msdn.com/joestagner/archive/2007/02/13/free-asp-net-ajax-1-0-how-do-i-videos-updated-for-final-release.aspx
Cheers - D
Monday, February 12, 2007
http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=keybinding&DisplayLang=en
Tuesday, February 06, 2007
ASP.NET AJAX 1.0 Released
ASP.NET AJAX 1.0 Released - ASP.NET AJAX is a free download with technical support provided by Microsoft. Create more sophisticated and interactive ASP.NET 2.0 Web sites that work across all browsers. Download today and start building a better Web!
The ASP.NET AJAX 1.0 Documentation can now be easily downloaded
ASP.NET AJAX Documentation
Microsoft ASP.NET AJAX documentation includes overviews, tutorials, samples, and API reference topics.
When you download the documentation, be sure to open the Readme.txt file for setup instructions. The download includes working samples to help you get the most out of ASP.NET AJAX.
Thansk - D
MSDN Webcast: Creating Dynamic Web Sites with ASP.NET 2.0 Web Parts (Level 300)
Thanks - D
Monday, February 05, 2007
Bill Gates launches Windows Vista, 2007 Microsoft Office...
Bill Gates launches Windows Vista, 2007 Microsoft Office
Watch the highlights as Bill Gates rolls out breakthrough versions of Microsoft's flagship products. You'll see how Windows Vista and the new Microsoft Office will transform the way people communicate, create and share content, and access information and entertainment.
Watch the webcast...
Cheers - D
LINQ - To be integrated with VS "Orcas"
Note that i made while reading was that you can use LINQ to write queries against varied multiple data sources like - SQL database, XML files or even the web service call.
You can check this implementation that supports LINQ calls to Amazon web service.
http://weblogs.asp.net/fmarguerie/archive/2006/06/26/Introducing-Linq-to-Amazon.aspx
Cheers - D