示例#1
0
        public SharepointSource(XElement xml, ISharepointHelperFactory sharepointHelperFactory)
            : base(xml)
        {
            _sharepointHelperFactory = sharepointHelperFactory;
            ResourceType             = "SharepointServerSource";
            AuthenticationType       = AuthenticationType.Windows;

            var properties = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "Server", string.Empty },
                { "AuthenticationType", string.Empty },
                { "UserName", string.Empty },
                { "Password", string.Empty }
            };

            var conString        = xml.AttributeSafe("ConnectionString");
            var connectionString = conString.CanBeDecrypted() ? DpapiWrapper.Decrypt(conString) : conString;

            ParseProperties(connectionString, properties);
            Server   = properties["Server"];
            UserName = properties["UserName"];
            Password = properties["Password"];
            var isSharepointSourceValue = xml.AttributeSafe("IsSharepointOnline");

            if (bool.TryParse(isSharepointSourceValue, out bool isSharepointSource))
            {
                IsSharepointOnline = isSharepointSource;
            }
            AuthenticationType = Enum.TryParse(properties["AuthenticationType"], true, out AuthenticationType authType) ? authType : AuthenticationType.Windows;
        }
示例#2
0
 public SharepointSource(ISharepointHelperFactory sharepointHelperFactory)
 {
     _sharepointHelperFactory = sharepointHelperFactory;
     ResourceID         = Guid.Empty;
     ResourceType       = "SharepointServerSource";
     AuthenticationType = AuthenticationType.Windows;
 }