コード例 #1
0
        static void Main()
        {
            CrmAuth auth = new CrmAuth();

            //CRM Online
            const string            url        = "https://org.crm.dynamics.com/";
            const string            username   = "******";
            const string            password   = "******";
            CrmAuthenticationHeader authHeader = auth.GetHeaderOnline(username, password, url);

            //End CRM Online

            //CRM OnPremise - IFD
            //const string url = "https://org.domain.com/";
            ////Username format could be domain\\username or username in the form of an email
            //const string username = "******";
            //const string password = "******";
            //CrmAuthenticationHeader authHeader = auth.GetHeaderOnPremise(username, password, url);

            if (authHeader == null)
            {
                return;
            }

            string id = CrmWhoAmI(authHeader, url);

            if (id == null)
            {
                return;
            }

            string name = CrmGetUserName(authHeader, id, url);

            Console.WriteLine(name);
        }
コード例 #2
0
        static void Main()
        {
            CrmAuth auth = new CrmAuth();

            //CRM Online
            const string url = "https://org.crm.dynamics.com/";
            const string username = "******";
            const string password = "******";
            CrmAuthenticationHeader authHeader = auth.GetHeaderOnline(username, password, url);
            //End CRM Online

            //CRM OnPremise - IFD
            //const string url = "https://org.domain.com/";
            ////Username format could be domain\\username or username in the form of an email
            //const string username = "******";
            //const string password = "******";
            //CrmAuthenticationHeader authHeader = auth.GetHeaderOnPremise(username, password, url);

            if (authHeader == null) return;

            string id = CrmWhoAmI(authHeader, url);
            if (id == null) return;

            string name = CrmGetUserName(authHeader, id, url);
            Console.WriteLine(name);
        }