October 23, 2009

Error: The specified type was not recognized: name='usersettings'

Simple task: Try to retrieve user settings of a CRM user.

Simple solution:
RetrieveUserSettingsSystemUserRequest request = new RetrieveUserSettingsSystemUserRequest();
request.EntityId = systemUserId;
request.ColumnSet = new AllColumns();

RetrieveUserSettingsSystemUserResponse response= (RetrieveUserSettingsSystemUserResponse)crmService.Execute(request);

NOT!

The specified type was not recognized: name='usersettings', namespace='http://schemas.microsoft.com/crm/2007/WebServices', at <BusinessEntity xmlns='http://schemas.microsoft.com/crm/2006/WebServices'>.

 

Real solution:

Add the following line: request.ReturnDynamicEntities = true;