예제 #1
0
        public static SiteEditMetadata ToSiteEditMetadata(SiteMetadata request)
        {
            var _newRequest = new SiteEditMetadata();            

            var _owner = new SiteUser()
            {
                Name = request.PrimaryOwnerName, 
                Email = request.PrimaryOwnerEmail               
            };            
            
            _newRequest.Url = request.Url;
            _newRequest.TenantAdminUrl = request.TenantAdminUrl;
            _newRequest.Title = request.Title;
            _newRequest.Description = request.Description;
            _newRequest.TimeZoneId = request.TimeZoneID;
            _newRequest.Lcid = request.lcid;
            _newRequest.AppliedSitePolicyName = request.SitePolicyName;
            _newRequest.SiteOwner = _owner;
            _newRequest.SitePolicy = request.SitePolicy; ;
            _newRequest.SharePointOnPremises = request.SharePointOnPremises;            
            _newRequest.EnableExternalSharing = request.EnableExternalSharing;
            _newRequest.BusinessUnit = request.BusinessUnit;
            _newRequest.Division = request.Division;
            _newRequest.Function = request.Function;
            _newRequest.Region = request.Region;

           
            return _newRequest;
        }
예제 #2
0
        public static SiteInformation ToSiteRequestInformation(SiteRequest request)
        {
            var _owner = new SiteUser()
            {
                Name = request.PrimaryOwner
            };

            List<SiteUser> _additionalAdmins = new List<SiteUser>();
            foreach (var secondaryOwner in request.AdditionalAdministrators)
            {
                if(!string.IsNullOrEmpty(secondaryOwner))
                {
                    var _sharePointUser = new SiteUser();
                    _sharePointUser.Name = secondaryOwner;
                    _additionalAdmins.Add(_sharePointUser);
                }
            }

            var _newRequest = new SiteInformation();
            _newRequest.Title = request.Title;
            _newRequest.Description = request.Description;
            _newRequest.Url = request.Url;
            _newRequest.TimeZoneId = request.TimeZoneID;
            _newRequest.Lcid = request.lcid;
            _newRequest.Template = request.Template;
            _newRequest.SitePolicy = request.SitePolicy;
            _newRequest.SiteOwner = _owner;
            _newRequest.AdditionalAdministrators = _additionalAdmins;
            _newRequest.SharePointOnPremises = request.SharePointOnPremises;
            _newRequest.BusinessCase = request.BusinessCase;
            _newRequest.EnableExternalSharing = request.EnableExternalSharing;
            _newRequest.IsConfidential = request.IsConfidential;


            if(request.Properties != null)
            {
                //Serialize Property Bag Entries
                _newRequest.SiteMetadataJson = JsonConvert.SerializeObject(request.Properties);
            }
            return _newRequest;
        }
예제 #3
0
        public SiteRequestInformation GetSiteRequestMock()
        {
            var _owner = new SiteUser()
            {
                Name = "*****@*****.**"
            };
            //Add addtional Users
            List<SiteUser> _additionalAdmins = new List<SiteUser>();
            SiteUser _admin1 = new SiteUser();
            _admin1.Name = "*****@*****.**";
            SiteUser _admin2 = new SiteUser();
            //  _admin2.Email = "*****@*****.**";
            _admin2.Name = "*****@*****.**";
            _additionalAdmins.Add(_admin1);
            _additionalAdmins.Add(_admin2);

            var _siteInfo = new SiteRequestInformation()
            {
                Title = "Test Title",
                Description = "Test Description",
                Template = "CT2",
                Url = "https://spsites.contoso.com/sites/B3",
                SitePolicy = "HBI",
                SiteOwner = _owner,
                AdditionalAdministrators = _additionalAdmins,
                EnableExternalSharing = true,
                SharePointOnPremises = true
            };

            return _siteInfo;

        }