コード例 #1
0
ファイル: CrmService.cs プロジェクト: fredp613/training_mvc
        public static IOrganizationService GetServiceProvider()
        {
            var crmService = new CrmService();
            IOrganizationService service = crmService._orgService;

            return(service);
        }
コード例 #2
0
ファイル: CrmService.cs プロジェクト: fredp613/training_mvc
        public static string GetTestUserInfo()
        {
            var crmService = new CrmService();
            IOrganizationService service = crmService._orgService;
            //// Obtain information about the logged on user from the web service.
            Guid userid = ((WhoAmIResponse)service.Execute(new WhoAmIRequest())).UserId;
            // Entity account = _orgService.Retrieve("Account", Guid.NewGuid(), new ColumnSet(new String[] { "accountid", "accountname" }));
            Entity systemUser = service.Retrieve("systemuser", userid,
                                                 new ColumnSet(new string[] { "firstname", "lastname" }));
            var user = String.Format("Logged on user is {0} {1}.", systemUser.GetAttributeValue <string>("firstname"), systemUser.GetAttributeValue <string>("lastname"));

            //return conn.IsReady.ToString();
            return(user);
        }