locked
is it possible to create a CRM user programmatically RRS feed

  • Question

  • Hi, is it possible to create a CRM user programmatically?  Assuming that the user exists in AD.  It would be useful to set up AD users and assign them roles programmatically. There is a lot of information available about creating custom entities via the metadataservice but I can't find any references to creating users except for a blog entry relating to CRM 1.0 /1.2 which discusses using the BizUser class (http://msdn.microsoft.com/en-us/library/aa476490.aspx) but that doesn't seem to be applicable in CRM 4.0.

    This is a new install of CRM4.0 with rollup 8 applied running on Windows Server 8.

    Many thanks in advance for any advice.

     
    Wednesday, January 27, 2010 4:26 PM

Answers

All replies

  • yes you can create user programmtically using hte same techinques of creating custom entity.
    check this thread. (it's in vb.net but you can easily convert it to c# in case you are working in C#).
    http://stackoverflow.com/questions/1790839/adding-a-new-user-to-crm-4-0-using-sdk

    you can use this tool to convert from vb.net to C#
    http://www.developerfusion.com/tools/convert/vb-to-csharp/
    • Proposed as answer by Muhammad Ali Khan Wednesday, January 27, 2010 5:27 PM
    • Marked as answer by Bob Bazely Thursday, January 28, 2010 11:52 AM
    Wednesday, January 27, 2010 5:24 PM
  • that's exactly what I was after! Thanks so much
    Bob
    Thursday, January 28, 2010 11:53 AM
  • Sure would have been nice if this code could read the info from AD account (email address etc.)
    Thursday, January 28, 2010 10:37 PM
  • Adding users to CRM programmatically is nice, but what about keeping their AD and CRM information in sync?  For example, we have many users who do not use CRM at all, and therefore receive no syncronization of CRM-based information to their Outlook by the way of contact information for other users inside the company.  Therefore, at the moment, we're having to update things like addresses and phone numbers in both AD, and CRM.
    Dave Berry
    Thursday, January 28, 2010 10:49 PM
    Moderator
  • Adding users to CRM programmatically is nice, but what about keeping their AD and CRM information in sync?  For example, we have many users who do not use CRM at all, and therefore receive no syncronization of CRM-based information to their Outlook by the way of contact information for other users inside the company.  Therefore, at the moment, we're having to update things like addresses and phone numbers in both AD, and CRM.
    Dave Berry

    And wouldn't it be wonderful if HR or whatever set of admins could use CRM to maintain this information for the office phone/mail stop directories and the Exchange address book information...

    And a license that allows staff to have userid WITHOUT access nor administrator privilage for free so they can be referenced in activities...
    Friday, January 29, 2010 3:45 PM