public object Resolve(object source, Dictionary <String, IResolver> resolvers = null, Boolean recursive = false) { Object result = null; // Try with the tenant-wide AppCatalog var tenant = source as Model.ProvisioningTenant; var appCatalog = tenant?.AppCatalog; if (null == appCatalog) { // If that one is missing, let's try with the local Site Collection App Catalog var alm = source as Model.ApplicationLifecycleManagement; appCatalog = alm?.AppCatalog; } if (null != appCatalog) { var appCatalogPackageTypeName = $"{PnPSerializationScope.Current?.BaseSchemaNamespace}.AppCatalogPackage, {PnPSerializationScope.Current?.BaseSchemaAssemblyName}"; var appCatalogPackageType = Type.GetType(appCatalogPackageTypeName, true); resolvers = new Dictionary <string, IResolver> { { $"{appCatalogPackageType}.SkipFeatureDeploymentSpecified", new ExpressionValueResolver(() => true) } }; var resolver = new CollectionFromModelToSchemaTypeResolver(appCatalogPackageType); result = resolver.Resolve(appCatalog.Packages, resolvers, true); } return(result); }
public object Resolve(object source, Dictionary <string, IResolver> resolvers = null, bool recursive = false) { Object result = null; var security = (source as Team)?.Security; if (null != security) { var teamSecurityTypeName = $"{PnPSerializationScope.Current?.BaseSchemaNamespace}.TeamSecurity, {PnPSerializationScope.Current?.BaseSchemaAssemblyName}"; var teamSecurityType = Type.GetType(teamSecurityTypeName, true); var teamSecurityUsersTypeName = $"{PnPSerializationScope.Current?.BaseSchemaNamespace}.TeamSecurityUsers, {PnPSerializationScope.Current?.BaseSchemaAssemblyName}"; var teamSecurityUsersType = Type.GetType(teamSecurityUsersTypeName, true); var teamSecurityUserTypeName = $"{PnPSerializationScope.Current?.BaseSchemaNamespace}.TeamSecurityUsersUser, {PnPSerializationScope.Current?.BaseSchemaAssemblyName}"; var teamSecurityUserType = Type.GetType(teamSecurityUserTypeName, true); result = Activator.CreateInstance(teamSecurityType); if (security.Owners != null && security.Owners.Count > 0) { var owners = Activator.CreateInstance(teamSecurityUsersType); owners.SetPublicInstancePropertyValue("ClearExistingItems", security.ClearExistingOwners); var usersResolver = new CollectionFromModelToSchemaTypeResolver(teamSecurityUserType); owners.SetPublicInstancePropertyValue("User", usersResolver.Resolve(security.Owners)); result.SetPublicInstancePropertyValue("Owners", owners); } if (security.Members != null && security.Members.Count > 0) { var members = Activator.CreateInstance(teamSecurityUsersType); members.SetPublicInstancePropertyValue("ClearExistingItems", security.ClearExistingOwners); var usersResolver = new CollectionFromModelToSchemaTypeResolver(teamSecurityUserType); members.SetPublicInstancePropertyValue("User", usersResolver.Resolve(security.Members)); result.SetPublicInstancePropertyValue("Members", members); } result.SetPublicInstancePropertyValue("AllowToAddGuests", security.AllowToAddGuests); } return(result); }