Esempio n. 1
0
        private async void checkData()
        {
            this.showProgress("Checking the login data ...");
#if false
            spglb.reinit(this);
            Boolean inited = await spglb.myClient.init();

            this.showProgress("");
            if (!inited)
            {
                lblResult.Text = DateTime.Now.ToString() + " could not connect with server." + Environment.NewLine + spglb.myClient.initError;
            }
            else
            {
                lblResult.Text = DateTime.Now.ToString() + " connected with server.";
            }
#else
            HMS.Auth.Login hmsLogin             = null;
            HMS.SP.SPEndpoints.SPEndpoints spEP = null;

            if (spOnlineLayout.IsVisible == true)
            {
                hmsLogin = new HMS.Auth.LoginSPO(spOnlineEntries["server"].Text, spOnlineEntries["user"].Text, spOnlineEntries["password"].Text);
                spEP     = new HMS.SP.SPEndpoints.SPOnline();
            }
            else if (sp2016Layout.IsVisible == true)
            {
                hmsLogin = new HMS.Auth.LoginNTLM(sp2016Entries["server"].Text, sp2016Entries["domain"].Text, sp2016Entries["user"].Text, sp2016Entries["password"].Text);
                spEP     = new HMS.SP.SPEndpoints.SPOnline();
            }
            else if (sp2010Layout.IsVisible == true)
            {
                hmsLogin = new HMS.Auth.LoginNTLM(sp2010Entries["server"].Text, sp2010Entries["domain"].Text, sp2010Entries["user"].Text, sp2010Entries["password"].Text);
                spEP     = new HMS.SP.SPEndpoints.SP2010();
            }
            if (hmsLogin != null)
            {
                hmsLogin.showProgress = showProgress;
                hmsLogin.setPlatform(this.platform);
                string ret = await hmsLogin.getJSON(spEP.Root);

                Boolean inited = hmsLogin.inited;
                this.showProgress("");
                if (!inited)
                {
                    lblResult.Text = DateTime.Now.ToString() + " could not connect with server." + Environment.NewLine + hmsLogin.initError;
                }
                else
                {
                    lblResult.Text = DateTime.Now.ToString() + " connected with server.";
                }
            }
            else
            {
                lblResult.Text = DateTime.Now.ToString() + " no server set.";
            }
#endif
        }
Esempio n. 2
0
        private async void checkDataBasic()
        {
            this.showProgress("Checking the login data ...");

            // we need this call, if we want to access the SP namespace
            spglb.reinit(this);

            HMS.Auth.Login hmsLogin             = null;
            HMS.SP.SPEndpoints.SPEndpoints spEP = null;


            hmsLogin  = new HMS.Auth.LoginBasic("http://winxmap/basic/", "authtest", "hello@123");
            spEP      = new HMS.SP.SPEndpoints.SPEndpoints();
            spEP.Root = "data.json";

            if (hmsLogin != null)
            {
                hmsLogin.showProgress = showProgress;
                hmsLogin.setPlatform(spglb.platform);
                string ret = await hmsLogin.getJSON(spEP.Root);

                Boolean inited = hmsLogin.inited;
                this.showProgress("");
                if (!inited)
                {
                    lblResult.Text = DateTime.Now.ToString() + " could not connect with server." + Environment.NewLine + hmsLogin.initError;
                }
                else
                {
                    lblResult.Text = DateTime.Now.ToString() + " connected with server.";
                }
            }
            else
            {
                lblResult.Text = DateTime.Now.ToString() + " no server set.";
            }
        }
Esempio n. 3
0
        public static void init(pageBase pb)
        {
            if (myClient == null)
            {
                try
                {
                    if ((Boolean)Application.Current.Properties["SPOnline.isSelected"] == true)
                    {
                        mode = HMS.SP.SPMode.SPOnline;
                    }
                    if ((Boolean)Application.Current.Properties["SP2010.isSelected"] == true)
                    {
                        mode = HMS.SP.SPMode.SP2010;
                    }
                    if ((Boolean)Application.Current.Properties["SP2016.isSelected"] == true)
                    {
                        mode = HMS.SP.SPMode.SP2016;
                    }
                }
                catch (Exception)
                {
                }
                if (mode == HMS.SP.SPMode.SPOnline)
                {
                    string baseurl  = "https://DOMAIN.sharepoint.com/";
                    string userName = "******";
                    string password = "******";

                    if (Application.Current.Properties.ContainsKey("SPOnline.server"))
                    {
                        baseurl = Application.Current.Properties["SPOnline.server"].ToString();
                    }
                    if (Application.Current.Properties.ContainsKey("SPOnline.user"))
                    {
                        userName = Application.Current.Properties["SPOnline.user"].ToString();
                    }
                    if (Application.Current.Properties.ContainsKey("SPOnline.password"))
                    {
                        password = Application.Current.Properties["SPOnline.password"].ToString();
                    }
                    // myClient = NETClient.SPOnline(baseurl, userName, password);
                    myClient    = new HMS.Auth.LoginSPO(baseurl, userName, password);
                    spEndpoints = new HMS.SP.SPEndpoints.SPOnline();
                }
                else if (mode == HMS.SP.SPMode.SP2010)
                {
                    string baseurl  = "http://win2008r2:12345/cm/";// this is an Intranet URL
                    string domain   = "DOMAIN";
                    string userName = "******";
                    string password = "******";
                    if (Application.Current.Properties.ContainsKey("SP2010.server"))
                    {
                        baseurl = Application.Current.Properties["SP2010.server"].ToString();
                    }
                    if (Application.Current.Properties.ContainsKey("SP2010.domain"))
                    {
                        domain = Application.Current.Properties["SP2010.domain"].ToString();
                    }
                    if (Application.Current.Properties.ContainsKey("SP2010.user"))
                    {
                        userName = Application.Current.Properties["SP2010.user"].ToString();
                    }
                    if (Application.Current.Properties.ContainsKey("SP2010.password"))
                    {
                        password = Application.Current.Properties["SP2010.password"].ToString();
                    }
                    // myClient = NETClient.SP2010(baseurl, domain, userName, password);
                    myClient    = new HMS.Auth.LoginNTLM(baseurl, domain, userName, password);
                    spEndpoints = new HMS.SP.SPEndpoints.SP2010();
                }
                else if (mode == HMS.SP.SPMode.SP2016)
                {
                    string baseurl  = "http://hmsspx/";// this is an Intranet URL
                    string domain   = "DOMAIN";
                    string userName = "******";
                    string password = "******";
                    if (Application.Current.Properties.ContainsKey("SP2016.server"))
                    {
                        baseurl = Application.Current.Properties["SP2016.server"].ToString();
                    }
                    if (Application.Current.Properties.ContainsKey("SP2016.domain"))
                    {
                        domain = Application.Current.Properties["SP2016.domain"].ToString();
                    }
                    if (Application.Current.Properties.ContainsKey("SP2016.user"))
                    {
                        userName = Application.Current.Properties["SP2016.user"].ToString();
                    }
                    if (Application.Current.Properties.ContainsKey("SP2016.password"))
                    {
                        password = Application.Current.Properties["SP2016.password"].ToString();
                    }
                    // myClient = NETClient.SP2016( baseurl, domain, userName, password);
                    myClient    = new HMS.Auth.LoginNTLM(baseurl, domain, userName, password);
                    spEndpoints = new HMS.SP.SPEndpoints.SP2016();
                }
                else
                {
                    throw new Exception("not implemented");
                }
            }
            myClient.showProgress = pb.showProgress;
            myClient.setPlatform(spglb.platform);
        }