Friday, September 23, 2011

Mysteries of the Microsoft Dynamics CRM 2011 SDK - Part 1

I know some of you have been following my journey through the SDK this year.  Over that period I have run into a few messages I have tried to implement successfully but they have eluded me.  Not just because I can't figure out how to implement them, but because they just don't seem to make a whole lot of sense.  Here are a few that I just don't get as of right now.  Your input would be greatly appreciated as the MSDN references for these requests are not complete and I can't find many other instances where people are using these requests and I am guessing it's for the same reasons I am laying out below.

Mystery Number 1 - RemoveParentRequest - Solved!, Thanks Jevgenij

What I Would Expect to Happen:
This seems to me like a pretty straight forward request.  I could use to to remove a parent account from an account or something to that effect.  It pretty much only has one member that isn't on every other request that I can see and that is Target which obviously takes an EntityReference.  I can just specify my entity that should have it's parent removed.

What's Just Seems Wrong:
It throws an error about not being able to find a valid SystemUser with the Guid I specified in my "account" EntityReference.  I am not really sure what they are looking for here since there is already a requests out there to remove members from teams and such.

Update: Thanks to Jevgenij, we now have our answer:  Check it out at

What still feels wrong:  
I feel like this call should be named RemoveManagerRequest or that it should work for more scenarios like the one where I was trying to remove the parent account from another account.  It's too generic because RemoveParentRequest doesn't imply that the call is entity specific; also it is further confusing because it asks for an EntityReference and the member is just named Target, which could be any entity type, where this should be just a Guid member called UserId maybe which would more descriptive.

Maybe they meant for this call to cover more scenarios but maybe those other scenarios were just never implemented.

Mystery Number 2 -  Any of the Search KB Article Requests (I.E. SearchByBodyKBArticleRequest) - Solved!  Thanks Mitch Milam!

What I Would Expect to Happen:
Ooh ooh.... This is great.  I can specify words and phrases that will be used to scour all of my KB articles to find the ones that contain those words.  This is great, it has all the properties I need.  I can specify my SearchText as a string, so we can look for things like "dolphins" or "snicker pops" or even "Jim Glass likes to eat clam chowder at Fisherman's Warf".  I can specify a SubjectId to narrow things down even further, this is awesome.

What's Just Seems Wrong:

What's this additional QueryExpression stuff that is required.  I understand QueryExpression syntax and such, but I don't know why I need it here considering we have all these great members on the request class already that specify everything I should need to search for a KB article.  I just don't know what to put there.  Also that SubjectId thing is required so you can't really search all the KB articles in one pop, you have to do it by subject, but never mind that right now considering I can't get it to work because I can't figure out what they want for the QueryExpression. :(


Mitch Milam (MVP) provided the answer for this item first, followed by Jevgenij. Check out the call example at:


This one was me just me not understanding  the QueryExpression necessity with this call.  It made perfect sense to me once it was explained to me and was, in the end, just a matter of lack of documentation.

Mystery Number 3 -  RetrieveUserIdByExternalIdRequest

What I Would Expect to Happen:
This is for CRM Online and is a call that is part of the discovery service.  The explanation given in TechNet is pretty straight forward:

"Contains the data needed to retrieve the Microsoft Dynamics CRM Online system user ID that is associated with a given Windows Live ID."

So this means that I can specify my Windows Live Id and this call will bounce it off of an organization in CRM Online and give me the associated User Id in the system.

What's Just Seems Wrong:

Nothing useful comes back, there are no errors, just a relatively empty, but valid, response envelope that doesn't have the User Id I requested.

In conclusion, there are some issues with the SDK that still make it an evolving product it seems, if not only in documentation.  These SDK requests may be completely valid and I just might not be able to find good enough documentation to be able to use them effectively.




  1. RemoveParentRequest
    Parent = Manager. This is used for removing manager for a user. As per Actions - Change Manager...

    QueryExpression is used to set attributes you require to be returned by the request.
    As per SDK: Assign an instance of the class FetchExpression, QueryExpression or QueryByAttribute. The query must specify the entity name “kbarticle” and a ColumnSet. If the column set includes attributes that are not valid for retrieve or for which you do not have access, they will be ignored.

    I think this would only work against CRM Online, and does nothing when You query on-premise installation.

  2. Thanks, I will feature the one call on Monday, but for RetrieveUserIdByExternalIdRequest, I was using CRM Online with a valid Windows Live ID

  3. Did you ever get any further with RetrieveUserIdByExternalIdRequest? I'm having the same issue with it and I can't find any useful documentation other than the sample code which I've replicated.