Saturday 31 December 2011

CRM Online can't find Microsoft.Xrm.Client.dll

Hi all,

Today I was writing (and I am still) a Plug-in for CRM online 2011 and counter a error as:
Could not load file or assembly 'Microsoft.Xrm.Client, Version=5.0.9688.1154, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
It happens because in my project I reference to Microsoft.Xrm.Client.dll and in the CRM online server this DLL is not installed.

I think this client dll is not intended to be used in server environment and therefore is not installed in CRM server.

I founded the generated code from crmsvcutil actually required the client dll if you include following parameter in your generation command .
/codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"
I re-generated the code file from crmsvcutil without the parameter and reload the project with an updated code file (Xrm.cs), recompile the project and it works :)

By the way, Happy 2012 :)

Tuesday 27 December 2011

Unable to connnect to CRM server (email router or Outlook client)

Today I experienced an error when connecting a outlook client to CRM server. The setting are excellently same as other computers. It turns out that the clock (on client PC) is out of sync and it could not establish a secured connect.

This is fixed by sync the time and re-connect :) not too hard after spending lot of time to find the bug.

Wednesday 21 December 2011

CRM4 primary character limit

Issues:
This morning I received an error from generic SQL error when a process tried to update an account record. The details error log looks like this:
>Exception when executing non-query: update ActivityPointerBase set RegardingObjectIdName='<<A very long account name>>' where (RegardingObjectId = '5cc47836-4867-e011-8520-005056860020' and RegardingObjectTypeCode = 1) Exception: System.Data.SqlClient.SqlException: String or binary data would be truncated.
 When I look in the error, it suggests the name is too long to be put in the reference object table. I checked the name attribute in account; it is set to 450 characters. However when I look at the database table RegardingObjectName is set to 400. When it try to inset the name it errors out.

Conclusion and lesion learn:
The character limits of primary attribute in CRM is 400. This apply to both CRM 4 and CRM 2011. To fix this simply truncate the name to 400 characters and update the attribute in account to 400 characters.

Thursday 15 December 2011

Delete Team Porjects on TFS online

I just found out you can delete a team project on TFS online via Visual Studio Command Prompt (2010).

Here is the command:


TFSDeleteproject [/q] [/force] [/excludewss] /collection:URL TeamProjectName
 
For more details refer to MSDN:
http://msdn.microsoft.com/en-us/library/ms181482.aspx#DeletionProcess

Wednesday 7 December 2011

Add send as permission to a mailbox


You can use the following PowerShell script to added send as permission to a mailbox. It suppose to work on office 365, However I have experience some difficulty and following this up with MS support engineer.

Add-RecipientPermission "support" -AccessRights SendAs -Trustee "Bob"

Referance URL: http://help.outlook.com/en-us/140/ff852815.aspx

Monday 5 September 2011

CRM 5 Auto number plug-in

Hi All, I was working in a lot of CRM 2011 deployment that would require auto counting / auto numbering functionality. However out of box CRM only support limited entities and the format are fixed. In addition you cannot modify the number, it always start at 1000.

To overcome this issue, I have created a simple solution and make it available to everyone. You can configure it in 3 easy steps
  1. installs the solution file 
  2. configure the counter setting 
  3. register the steps in plug-in Source code

Solution file and installation instruction can be find in http://crm2011counter.codeplex.com/ Ps: It was tested and working on CRM online and on premises environment.

Monday 15 August 2011

Simple way to debug JavaScript in CRM 2011

Here is a really simple to debug JavaScript in CRM 2011

1. Install IE debug tools and turn off “Disable script debugging” in internet option> Advance
2. Go to where the JavaScript is triggered.
3. Hit F12 to launch debugger
4. Click Script tab




5. Select Script files










6. Put a breakpoint

Monday 8 August 2011

Exchange online 2010 assign mailbox permission

Microsoft does not provide a graphic user interface for admin to add/modify mailbox permissions for individual mailboxes in in Exchange online 2010 (Office 365). If you would like to modify mailboxes permissions you will find yourself in doing PowerShell script.

Here is a simple script that will allow you to connect to Office 365 and add permission to a mailbox:

 # Set execution policy, you can skip this if you already done this in the past
Set-ExecutionPolicy RemoteSigned

#Create connection section. a login will popup to ask you to loin. Make sure you login as admin
$LiveCred = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

Import-PSSession $Session

#This line actually add permission. This example actually add permission for admin to access info mailbox
Add-MailboxPermission  -Identity info@contoso.com  -user admin@contoso.com -AccessRights FullAccess

# End of script, Enjoy