This weekend, while working on a white paper, I noticed an error in the SDK documentation for the SendEmailRequest.TrackingToken field. It states:
The tracking token is used to correlate an e-mail with a context. You can generate a tracking token with the GetTrackingTokenEmail message. If this field is unspecified it defaults to null. In this case, the SendEmail message generates a tracking token automatically.
You must supply a value for this field. The following are all all valid:
SendEmailRequest.TrackingToken = ""; SendEmailRequest.TrackingToken = string.Empty; SendEmailRequest.TrackingToken = "My Tracking Token";
If SendEmailRequest.TrackingToken is null or undeclared, you will receive an exception.
If SendEmailRequest.TrackingToken is blank, CRM will automatically insert the next available tracking token, such as: CRM:00010029. If SendEmailRequest.TrackingToken contains a value, that value will be inserted as the tracking token.
Morning Folks,
A couple of months ago, we started a conversation on this blog regarding the identification of CRM Accounts that have been shared. Satoshi Kawamura of Collins Computing came up with a SQL script that will solve the solution, and with his permission, I am posting it here.
Note: this needs to be run via SQL Query Analyzer on the <Organization Name>_MSCRM database.
select ChangedOn 'Shared on', name 'Account Name', fullname 'Share Name', owneridname 'Account Owner', 'User' 'Type' from PrincipalObjectAccess, FilteredAccount, FilteredSystemUser where PrincipalObjectAccess.ObjectTypeCode = 1 and PrincipalObjectAccess.ObjectId = FilteredAccount.accountid and PrincipalObjectAccess.PrincipalId = FilteredSystemUser.systemuserid union select ChangedOn 'Shared On', FilteredAccount.name 'Share Name', FilteredTeam.name, owneridname 'Account Owner', 'Team' 'Type' from PrincipalObjectAccess, FilteredAccount, FilteredTeam where PrincipalObjectAccess.ObjectTypeCode = 1 and PrincipalObjectAccess.ObjectId = FilteredAccount.accountid and PrincipalObjectAccess.PrincipalId = FilteredTeam.teamid order by name
This will product a report similar to the following:
I should also note that this will only produce a list of shared Accounts. Should you wish Contacts, you will need to replace each instance of "FilteredAccount" with "FilteredContact" and change "ObjectTypeCode = 1" to "ObjectTypeCode = 2".
Great work Steve, and thanks for sharing.
I spent some time this weekend working on a utility that relies on the CRMService Import, Export, and Publish methods. While the sample code shipped with the CRM SDK ( v3.0.5 ) is fairly useful, I thought I'd give you a more real world example of the ImportAllXml and ExportAllXml API methods;
ImportAllXml
Import all customizations from an XML file. For more information, review the following SDK documentation. Substitute the SDK example with the following code, which reads the XML from a file.
// Set up the CRM Service. CrmService service = new CrmService(); service.Credentials = System.Net.CredentialCache.DefaultCredentials; // This is a potentially long running operation. The default 90-second // time-out might be too short. Set the time-out to be 5 minutes. // This property takes milliseconds. service.Timeout = 300 * 1000; using(System.IO.StreamReader reader = new System.IO.StreamReader("importfile.xml")) { string entityXml = reader.ReadToEnd(); // Create the request. ImportAllXmlRequest importRequest = new ImportAllXmlRequest(); // Tell the request where the XML is located. importRequest.CustomizationXml = entityXml; // Execute the import. ImportAllXmlResponse importResponse = (ImportAllXmlResponse)service.Execute(importRequest); }
ExportAllXml
Export all customizations to an XML file. For more information, review the following SDK documentation. Substitute the SDK example with the following code, which writes the XML to a file.
//Set up the CRM Service. CrmService service = new CrmService(); service.Credentials = System.Net.CredentialCache.DefaultCredentials; // Create the request. ExportAllXmlRequest request = new ExportAllXmlRequest(); // Execute the request. ExportAllXmlResponse response = (ExportAllXmlResponse)service.Execute(request); using(System.IO.StreamWriter writer = new System.IO.StreamWriter("exportfile.xml")) { writer.Write(response.ExportXml); writer.Flush(); }





