Exemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var url      = tbSiteUrl.Text;
            var userName = tbUserName.Text;
            var password = tbPassword.Text;

            if (!Utilities.Utilities.IsValidUrl(url))
            {
                Utilities.Utilities.ShowErrorMessage("Invalid URL",
                                                     "You entered an invalid URL\n\rPlease try again");
                return;
            }

            if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(password))
            {
                Utilities.Utilities.ShowErrorMessage("Invalid username/password",
                                                     "You entered an invalid username or password.\n\rPlease try again");
                return;
            }

            try
            {
                var sharepointClient = new SharepointClient(url, userName, password);
                SharepointClient = sharepointClient;
                Close();
            }
            catch (Exception exception)
            {
                Utilities.Utilities.ShowErrorMessage("Failed to connect",
                                                     "Could not connect to Sharepoint Online\r\nPlease chech URL and credentials, and try again");
            }
        }
Exemplo n.º 2
0
        public void Init()
        {
            _toolkitUserRepository = new Repository <ToolkitUser>();

            _toolkitUser = _toolkitUserRepository.GetData();

            try
            {
                _toolkitUser.SecurePassword =
                    new NetworkCredential("", _encryptionManager.DecryptText(_toolkitUser.Password)).SecurePassword;
            }
            catch (Exception)
            {
                _toolkitUser.SecurePassword = new NetworkCredential("", "").SecurePassword;
            }
            _toolkitUser.Password = "";

            _sharepointClient = new SharepointClient();
            _clientContext    = new ClientContext("https://goto.netcompany.com/cases/GTO22/NCMOD")
            {
                Credentials = new NetworkCredential(_toolkitUser.Name, _toolkitUser.SecurePassword, _toolkitUser.Domain)
            };
        }
Exemplo n.º 3
0
 public LibraryInformation(string listName, string destinationFolder, SharepointClient sharePointClient)
 {
     ListName          = listName;
     DestinationFolder = destinationFolder;
     SharepointClient  = sharePointClient;
 }
Exemplo n.º 4
0
        public void UpdateSPCamlQueryTest()
        {
            const string fieldName = "Periode_x0020_for_x0020_tidsregi";
            CamlQuery    query;
            var          timeSlots = new List <Timeslot>
            {
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "07:00-17:00"
                    }
                }
            };
            var rowLimit = 5;

            query = SharepointClient.UpdateCamlQuery(timeSlots, fieldName, rowLimit);

            timeSlots = new List <Timeslot>
            {
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "07:00-17:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "17:00-22:00"
                    }
                }
            };
            rowLimit = 5;
            query    = SharepointClient.UpdateCamlQuery(timeSlots, fieldName, rowLimit);

            timeSlots = new List <Timeslot>
            {
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "07:00-17:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "17:00-22:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "22:00-04:00"
                    }
                }
            };
            rowLimit = 5;
            query    = SharepointClient.UpdateCamlQuery(timeSlots, fieldName, rowLimit);

            timeSlots = new List <Timeslot>
            {
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "07:00-17:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "17:00-22:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "22:00-04:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "04:00-06:00"
                    }
                }
            };
            rowLimit = 5;
            query    = SharepointClient.UpdateCamlQuery(timeSlots, fieldName, rowLimit);

            timeSlots = new List <Timeslot>
            {
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "07:00-17:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "17:00-22:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "22:00-04:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "04:00-06:00"
                    }
                },
                new Timeslot {
                    TimeInterval = new TimeInterval {
                        Interval = "06:00-07:00"
                    }
                }
            };
            rowLimit = 5;
            query    = SharepointClient.UpdateCamlQuery(timeSlots, fieldName, rowLimit);

            Assert.AreEqual(1, 2);
        }