Getting the username of SystemUser in a C# console application (Dynamics CRM) -
is there way username (or fullname or of off systemuser) in regular c# console application?
if whoamirequest , use userid retrieve "systemuserentity" organizationservice, says there's no entity name 'systemuser'.
if try make request userid odata rest endpoint (for example: http://localhost:8081/testorg/xrmservices/2011/organizationdata.svc/systemuserset(guid'58a30c1a-3730-e511-80c8-080027c078bd'), keep getting 401 forbidden, although if paste link browser, of info need. far understand, because have authentification when using browser.
so, possible question "how correct authentification in c# console application talk odata rest endpoint".
retrieving fullname once have user id works this:
// guid userid = ... var username = service.retrieve("systemuser", userid, new columnset("fullname")).getattributevalue<string>("fullname");
caveat being, have use logical names (all lowercase) instead of schema (capitalized) name, i.e. systemuser
instead of systemuser
Comments
Post a Comment