diff --git a/console_spo_utils/Constants/Fields.cs b/console_spo_utils/Constants/Fields.cs index 9ad95bd..c58017b 100644 --- a/console_spo_utils/Constants/Fields.cs +++ b/console_spo_utils/Constants/Fields.cs @@ -1,4 +1,6 @@ -namespace console_spo_utils.Constants; +using console_spo_utils.Services; + +namespace console_spo_utils.Constants; public static class Fields { @@ -49,6 +51,49 @@ public static class Fields } } + public static string[] QuotationView + { + get + { + return new string[] + { + "Type", + "Name", + "ID Offerta", + "Fornitore", + "Causale", + "Autore" + }; + } + } + + public static Dictionary SyntheticProjList + { + get + { + return new Dictionary() + { + { SynthticProjTitle[0], ""+"01 VENDITA MACCHINE / IMPIANTI" }, + { SynthticProjTitle[1], "02 VENDITA RICAMBI" }, + { SynthticProjTitle[2], "01 VENDITA MACCHINE / IMPIANTI"+ + "02 VENDITA RICAMBI"} + }; + } + } + + public static string[] SynthticProjTitle + { + get + { + return new[] + { + "Sintetica-caus01", + "Sintetica-caus02", + "Sintetica-causXX" + }; + } + } + public static Dictionary ProjectCustomFields { get diff --git a/console_spo_utils/Interfaces/Services/IProjectService.cs b/console_spo_utils/Interfaces/Services/IProjectService.cs new file mode 100644 index 0000000..366c6bc --- /dev/null +++ b/console_spo_utils/Interfaces/Services/IProjectService.cs @@ -0,0 +1,8 @@ +namespace console_spo_utils.Interfaces.Services; + +public interface IProjectService +{ + public void BuildWebParts(); + + +} \ No newline at end of file diff --git a/console_spo_utils/Interfaces/Services/IProjectYearService.cs b/console_spo_utils/Interfaces/Services/IProjectYearService.cs index f45c0da..a745dec 100644 --- a/console_spo_utils/Interfaces/Services/IProjectYearService.cs +++ b/console_spo_utils/Interfaces/Services/IProjectYearService.cs @@ -5,6 +5,6 @@ namespace console_spo_utils.Interfaces.Services; public interface IProjectYearService { - public void ProjectsYList(string listTitle, ClientContext ctx); + public void CreateList(string listTitle, ClientContext ctx); } \ No newline at end of file diff --git a/console_spo_utils/Interfaces/Services/ISiteOptions.cs b/console_spo_utils/Interfaces/Services/ISiteOptions.cs index a1c5e24..da9a107 100644 --- a/console_spo_utils/Interfaces/Services/ISiteOptions.cs +++ b/console_spo_utils/Interfaces/Services/ISiteOptions.cs @@ -6,8 +6,8 @@ public interface ISiteOptions { public string TokenEndpoint { get; } public string DefaultAadAppId { get; } - public Uri GetProjectSite(); - public string GetProjTenant(); + public Uri GetProjectYearSite(); + public string GetProjYearTenant(); public string GetUser(); public SecureString GetPassword(); public string GetProjListTitle(); @@ -16,4 +16,6 @@ public interface ISiteOptions Uri GetQuotationSite(); string GetSubProjList(string projName); public string GetQuotationLibrary(); + public Uri GetProjectSite(); + } \ No newline at end of file diff --git a/console_spo_utils/Interfaces/Services/IWebpartService.cs b/console_spo_utils/Interfaces/Services/IWebpartService.cs new file mode 100644 index 0000000..5b31e29 --- /dev/null +++ b/console_spo_utils/Interfaces/Services/IWebpartService.cs @@ -0,0 +1,9 @@ +using Microsoft.SharePoint.Client; +using Microsoft.SharePoint.Client.WebParts; + +namespace console_spo_utils.Interfaces.Services; + +public interface IWebpartService +{ + public void AddWebPart(Web web, LimitedWebPartManager mgr, string xmlSchema, string listName, string zoneName,int zoneId); +} \ No newline at end of file diff --git a/console_spo_utils/Model/XmlFieldsModel.cs b/console_spo_utils/Model/XmlFieldsModel.cs deleted file mode 100644 index 2970aed..0000000 --- a/console_spo_utils/Model/XmlFieldsModel.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.Xml.Serialization; - -namespace console_spo_utils.Model; -[XmlRoot(ElementName = "Field")] - -public class XmlFieldsModel //TODO ha senso ? se come funziona? -{ - [XmlAttribute(AttributeName = "Name")] - public string Name { get; set; } - [XmlAttribute(AttributeName = "Type")] - public string Type { get; set; } - [XmlAttribute(AttributeName = "Description")] - public string Description { get; set; } - [XmlAttribute(AttributeName = "DisplayName")] - public string DisplayName { get; set; } - [XmlAttribute(AttributeName = "StaticName")] - public string StaticName { get; set; } - [XmlAttribute(AttributeName = "Group")] - public string Group { get; set; } - [XmlAttribute(AttributeName = "Hidden")] - public string Hidden { get; set; } - [XmlAttribute(AttributeName = "Required")] - public string Required { get; set; } - [XmlAttribute(AttributeName = "Sealed")] - public string Sealed { get; set; } - [XmlAttribute(AttributeName = "ShowInDisplayForm")] - public string ShowInDisplayForm { get; set; } - [XmlAttribute(AttributeName = "ShowInEditForm")] - public string ShowInEditForm { get; set; } - [XmlAttribute(AttributeName = "ShowInNewForm")] - public string ShowInNewForm { get; set; } - - - - public static string ParseToString(string fieldKey, List fieldValue) - { - var model = ParseFromString(fieldKey, fieldValue); - - var xmlSerializer = new XmlSerializer(model.GetType()); - - using StringWriter textWriter = new StringWriter(); - xmlSerializer.Serialize(textWriter, model); - return textWriter.ToString(); - } - - - - public static XmlFieldsModel ParseFromString(string fieldKey, List fieldValue) - { - - // var fieldXml = $""; - - return new XmlFieldsModel() - { - Name = fieldKey, - Type = fieldValue[0], - - }; - } -} \ No newline at end of file diff --git a/console_spo_utils/Program.cs b/console_spo_utils/Program.cs index a3daa00..3b8739d 100644 --- a/console_spo_utils/Program.cs +++ b/console_spo_utils/Program.cs @@ -45,6 +45,8 @@ namespace console_spo_utils services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); return services; } diff --git a/console_spo_utils/Services/OneNoteService.cs b/console_spo_utils/Services/OneNoteService.cs index f0673f4..0e3d7a8 100644 --- a/console_spo_utils/Services/OneNoteService.cs +++ b/console_spo_utils/Services/OneNoteService.cs @@ -31,7 +31,7 @@ public class OneNoteService : IOneNoteService ctx.Load(list, l => l.RootFolder); ctx.ExecuteQuery(); - var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetProjTenant()} Notebook/{projName}"); + var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetProjYearTenant()} Notebook/{projName}"); list.RootFolder.AddSubFolderUsingPath(rPath); ctx.ExecuteQuery(); @@ -57,7 +57,7 @@ public class OneNoteService : IOneNoteService ctx.Load(list, l => l.RootFolder); ctx.ExecuteQuery(); - var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{quotationName}"); + var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{DateTime.Today.Year}/{quotationName}"); list.RootFolder.AddSubFolderUsingPath(rPath); ctx.ExecuteQuery(); diff --git a/console_spo_utils/Services/ProjectQuickMenuService.cs b/console_spo_utils/Services/ProjectQuickMenuService.cs index a74e5cb..7b40bdf 100644 --- a/console_spo_utils/Services/ProjectQuickMenuService.cs +++ b/console_spo_utils/Services/ProjectQuickMenuService.cs @@ -39,8 +39,8 @@ public class ProjectQuickMenuService : IProjectQuickMenuService spNavNodeColl.Add(newNavNode); ctx.ExecuteQuery(); - logger.LogInformation($"> Il menu rapido è stato aggiornato in {projName}"); + logger.LogInformation($"> Il menu rapido è stato aggiornato in {projName}"); if (name != $"SottoCommesse {projName}") { diff --git a/console_spo_utils/Services/ProjectService.cs b/console_spo_utils/Services/ProjectService.cs new file mode 100644 index 0000000..18286d5 --- /dev/null +++ b/console_spo_utils/Services/ProjectService.cs @@ -0,0 +1,115 @@ +using console_spo_utils.Constants; +using console_spo_utils.Interfaces.Services; +using Microsoft.Extensions.Logging; +using Microsoft.SharePoint.Client; +using Microsoft.SharePoint.Client.WebParts; + +namespace console_spo_utils.Services; + +public class ProjectService : IProjectService +{ + private readonly ISiteOptions siteOptions; + private readonly ISharePointAuthenticationManager sharePointAuthenticationManager; + private readonly IWebpartService webpartService; + private readonly ILogger logger; + + public ProjectService(ISiteOptions siteOptions, + ISharePointAuthenticationManager sharePointAuthenticationManager, + IWebpartService webpartService, + ILogger logger, + IProjectQuickMenuService projectQuickMenuService) + { + this.siteOptions = siteOptions; + this.sharePointAuthenticationManager = sharePointAuthenticationManager; + this.webpartService = webpartService; + this.logger = logger; + } + + public void BuildWebParts() + { + try + { + string wpName = siteOptions.GetProjYearTenant(); + + var listView = GetListsId(siteOptions.GetProjListTitle(), Fields.SynthticProjTitle); + + var ctx = sharePointAuthenticationManager.GetContext(siteOptions.GetProjectSite()); + Web web = ctx.Web; + var file = web.GetFileByServerRelativeUrl("/sites/Commesse/SitePages/ProjectHome.aspx"); + ctx.Load(web); + ctx.ExecuteQuery(); + + LimitedWebPartManager mgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared); + + string url = siteOptions.GetProjectYearSite() + "/Lists/" + + siteOptions.GetProjListTitle().Replace(" ", "%20") + + "/" + siteOptions.GetProjListTitle().Replace(" ", "%20") + ".aspx?viewid="; + string htmlSchema = $"

{siteOptions.GetProjYearTenant()}

" + + $"

Progetti Macchiana
Solo i progetti di vendita Macchine/Impianti

" + + $"

Progetti Ricambi
Altri Progetti

" + + $"

Altri Progetti
Tutti gli altri progetti che non siano di vendita Macchine/Impianti o Ricambi

"; + + string xmlSchema = "" + + "" + + $"{siteOptions.GetProjYearTenant()}None" + + "true0" + + "Microsoft.SharePoint, Version=13.0.0.0, Culture=neutral, " + + "PublicKeyToken=94de0004b6e3fcc5" + + "Microsoft.SharePoint.WebPartPages.ContentEditorWebPart" + + "" + + "" + + $"" + + ""; + + webpartService.AddWebPart(web, mgr, xmlSchema, wpName, "Body", 0); + + var qm = new NavigationNodeCreationInformation() + { + Title = siteOptions.GetProjYearTenant(), + Url = siteOptions.GetProjectYearSite().ToString(), + AsLastNode = true + }; + + web.Navigation.QuickLaunch.Add(qm); + + ctx.ExecuteQuery(); + } + catch (Exception ex) + { + logger.LogError(ex, "Tenant Creation"); + } + } + + private Dictionary GetListsId(string listTitle, string[] listViewTitle) + { + Dictionary listViewId = new Dictionary(); + + try + { + foreach (var lViewTitle in listViewTitle) + { + var ctx = sharePointAuthenticationManager.GetContext(siteOptions.GetProjectYearSite()); + + var list = ctx.Web.Lists.GetByTitle(listTitle); + ctx.Load(list.Views); + + var listView = list.Views.GetByTitle(lViewTitle); + ctx.Load(listView, l => l.Id); + ctx.ExecuteQuery(); + + var id = listView.Id; + + listViewId.Add(lViewTitle, id.ToString()); + } + + } + catch (Exception ex) + { + logger.LogError(ex, "Get List Id for Web Part"); + } + + return listViewId; + } +} \ No newline at end of file diff --git a/console_spo_utils/Services/ProjectYearService.cs b/console_spo_utils/Services/ProjectYearService.cs index 0696cb3..543b018 100644 --- a/console_spo_utils/Services/ProjectYearService.cs +++ b/console_spo_utils/Services/ProjectYearService.cs @@ -5,17 +5,20 @@ using Microsoft.SharePoint.Client; namespace console_spo_utils.Services; -public class ProjectYearService:IProjectYearService +public class ProjectYearService : IProjectYearService { private readonly ILogger logger; + private readonly IProjectService projectService; public ProjectYearService( - ILogger logger) + ILogger logger, + IProjectService projectService) { this.logger = logger; + this.projectService = projectService; } - public void ProjectsYList(string listTitle, ClientContext ctx) + public void CreateList(string listTitle, ClientContext ctx) { try { @@ -79,14 +82,13 @@ public class ProjectYearService:IProjectYearService var views = list.Views; - ViewCreationInformation viewCreation = new ViewCreationInformation(); - viewCreation.SetAsDefaultView = true; viewCreation.Title = listTitle; - viewCreation.ViewTypeKind = ViewType.None; + viewCreation.ViewTypeKind = ViewType.Html; viewCreation.ColumnWidth = "350"; viewCreation.ViewFields = Fields.SiteFields; + viewCreation.SetAsDefaultView = true; var view = views.Add(viewCreation); @@ -104,18 +106,64 @@ public class ProjectYearService:IProjectYearService Console.WriteLine($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'."); + ctx.Web.RootFolder.WelcomePage = $"Lists/{listTitle}/{listTitle}.aspx"; ctx.Web.RootFolder.Update(); ctx.ExecuteQuery(); - Console.WriteLine($"> Impostata come HomePage di '{viewCreation.Title}'"); + CreateViewList(list, ctx); + projectService.BuildWebParts(); + + + Console.WriteLine($"> Impostata come HomePage di '{viewCreation.Title}'"); #endregion } catch (Exception ex) { - logger.LogError(ex,"Project Years"); + logger.LogError(ex, "Project Years"); + } + } + + public void CreateViewList(List list, ClientContext ctx) + { + try + { + foreach (KeyValuePair listTitle in Fields.SyntheticProjList) + { + Console.WriteLine($"> Inizializzata la fase di creazione della ListView '{listTitle}'."); + + var views = list.Views; + + ViewCreationInformation viewCreation = new ViewCreationInformation(); + + viewCreation.Title = listTitle.Key; + viewCreation.ViewTypeKind = ViewType.Html; + viewCreation.ColumnWidth = "350"; + viewCreation.ViewFields = Fields.SiteFields; + viewCreation.Query = $"{listTitle.Value}"; + + var view = views.Add(viewCreation); + + ctx.Load(view); + ctx.ExecuteQuery(); + + Console.WriteLine($"> Completata la fase di creazione della ListView '{viewCreation.Title}'."); + + var customView = views.GetByTitle(viewCreation.Title); + customView.MobileView = true; + + customView.Update(); + ctx.ExecuteQuery(); + + Console.WriteLine($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'."); + } + + } + catch (Exception ex) + { + logger.LogError(ex, "Project Years"); } } } \ No newline at end of file diff --git a/console_spo_utils/Services/SharePointStructureBuilderService.cs b/console_spo_utils/Services/SharePointStructureBuilderService.cs index 627ab54..9faefff 100644 --- a/console_spo_utils/Services/SharePointStructureBuilderService.cs +++ b/console_spo_utils/Services/SharePointStructureBuilderService.cs @@ -10,17 +10,20 @@ public class SharePointStructureBuilderService : ISharePointStructureBuilder private readonly ISubProjectRepository subProjectRepository; private readonly ISubProjectBuilderService subProjectBuilderService; private readonly IQuotationBuildService quotationBuildService; + private readonly IWebpartService webpartService; public SharePointStructureBuilderService( ISiteService siteService, ISubProjectRepository subProjectRepository, ISubProjectBuilderService subProjectBuilderService, - IQuotationBuildService quotationBuildService) + IQuotationBuildService quotationBuildService, + IWebpartService webpartService) { this.siteService = siteService; this.subProjectRepository = subProjectRepository; this.subProjectBuilderService = subProjectBuilderService; this.quotationBuildService = quotationBuildService; + this.webpartService = webpartService; } diff --git a/console_spo_utils/Services/SiteOptions.cs b/console_spo_utils/Services/SiteOptions.cs index 4395ff8..c02b3ac 100644 --- a/console_spo_utils/Services/SiteOptions.cs +++ b/console_spo_utils/Services/SiteOptions.cs @@ -1,6 +1,7 @@ using System.Net; using System.Security; using console_spo_utils.Interfaces.Services; +using Microsoft.Crm.Sdk.Messages; namespace console_spo_utils.Services; @@ -10,9 +11,9 @@ public class SiteOptions : ISiteOptions private const string SiteCollection = "https://italsortbuttrio.sharepoint.com"; public string TokenEndpoint { get; } = "https://login.microsoftonline.com/common/oauth2/token"; public string DefaultAadAppId { get; } = "46e6296e-176f-4ebb-a14b-bdd5678c16e6"; - public Uri GetProjectSite() + public Uri GetProjectYearSite() { - return new Uri($"{SiteCollection}/sites/{GetProjTenant().Replace(" ","")}"); + return new Uri($"{SiteCollection}/sites/{GetProjYearTenant().Replace(" ","")}"); } private static int GetYear() @@ -20,7 +21,7 @@ public class SiteOptions : ISiteOptions return DateTime.Today.Year; } - public string GetProjTenant() + public string GetProjYearTenant() { return $"Commesse {GetYear()}"; } @@ -37,12 +38,12 @@ public class SiteOptions : ISiteOptions public string GetProjListTitle() { - return $"Lista {GetProjTenant()}"; + return $"Lista {GetProjYearTenant()}"; } public Uri GetSubProjSite(string projName) { - return new Uri($"{GetProjectSite()}/{projName}"); + return new Uri($"{GetProjectYearSite()}/{projName}"); } public string GetQuotationTenant() @@ -64,4 +65,14 @@ public class SiteOptions : ISiteOptions { return $"SottoCommesse {projName}"; } + + private string GetProjectTenant() + { + return "Commesse"; + } + + public Uri GetProjectSite() + { + return new Uri($"{SiteCollection}/sites/{GetProjectTenant()}"); + } } \ No newline at end of file diff --git a/console_spo_utils/Services/SiteService.cs b/console_spo_utils/Services/SiteService.cs index 094785e..fbf7452 100644 --- a/console_spo_utils/Services/SiteService.cs +++ b/console_spo_utils/Services/SiteService.cs @@ -50,7 +50,7 @@ public class SiteService : ISiteService { try { - var site = siteOptions.GetProjectSite(); + var site = siteOptions.GetProjectYearSite(); var listTitle = siteOptions.GetProjListTitle(); using var ctx = authMgr.GetContext(site); if (spc.SiteExist(ctx)) @@ -58,7 +58,7 @@ public class SiteService : ISiteService return true; } tenantService.CreateForProject(); - projectYearService.ProjectsYList(listTitle,ctx); + projectYearService.CreateList(listTitle,ctx); } catch (Exception e) @@ -73,7 +73,7 @@ public class SiteService : ISiteService public bool CreateSubSiteIfNotExists(string projName) { - var projectSite = siteOptions.GetProjectSite(); + var projectSite = siteOptions.GetProjectYearSite(); var subProjSite = siteOptions.GetSubProjSite(projName); var siteContext = authMgr.GetContext(projectSite); @@ -135,7 +135,7 @@ public class SiteService : ISiteService try { var listTitle = siteOptions.GetProjListTitle(); - var tenant = siteOptions.GetProjTenant().Replace(" ",string.Empty); + var tenant = siteOptions.GetProjYearTenant().Replace(" ",string.Empty); var list = ctx.Web.Lists.GetByTitle(listTitle); var itemCreateInfo = new ListItemCreationInformation(); @@ -161,5 +161,4 @@ public class SiteService : ISiteService logger.LogError(ex, "Create List Entry"); } } - } \ No newline at end of file diff --git a/console_spo_utils/Services/TenantService.cs b/console_spo_utils/Services/TenantService.cs index 74a5908..7a90848 100644 --- a/console_spo_utils/Services/TenantService.cs +++ b/console_spo_utils/Services/TenantService.cs @@ -34,8 +34,8 @@ public class TenantService : ITenantService public void CreateForProject() { TenantCreation( - siteOptions.GetProjTenant(), - siteOptions.GetProjectSite(), + siteOptions.GetProjYearTenant(), + siteOptions.GetProjectYearSite(), PalFieldType.Project ); } @@ -90,12 +90,11 @@ public class TenantService : ITenantService oneNoteService.EnableFeature(ctx); - cpt.PalCustomField(ctx,fieldType); + cpt.PalCustomField(ctx, fieldType); } catch (Exception ex) { - logger.LogError(ex,"Tenant Creation"); + logger.LogError(ex, "Tenant Creation"); } - } } \ No newline at end of file diff --git a/console_spo_utils/Services/WebpartService.cs b/console_spo_utils/Services/WebpartService.cs new file mode 100644 index 0000000..7930e01 --- /dev/null +++ b/console_spo_utils/Services/WebpartService.cs @@ -0,0 +1,44 @@ +using console_spo_utils.Interfaces.Services; +using Microsoft.Extensions.Logging; +using Microsoft.Graph; +using Microsoft.SharePoint.Client; +using Microsoft.SharePoint.Client.WebParts; +using OfficeDevPnP.Core.Pages; + +//using PnP.Core.Model; + + +namespace console_spo_utils.Services +{ + public class WebpartService : IWebpartService + { + private readonly ILogger logger; + private readonly ISharePointAuthenticationManager authMgr; + private readonly ISiteOptions siteOptions; + + public WebpartService( + ILogger logger, + ISharePointAuthenticationManager authMgr, + ISiteOptions siteOptions) + { + this.logger = logger; + this.authMgr = authMgr; + this.siteOptions = siteOptions; + } + + public void AddWebPart(Web web, LimitedWebPartManager mgr, string xmlSchema, string listName, string zoneName, int zoneId) + { + try + { + WebPartDefinition def = mgr.ImportWebPart(xmlSchema); + def.WebPart.Hidden = false; + mgr.AddWebPart(def.WebPart, zoneName, zoneId); + mgr.Context.ExecuteQuery(); + } + catch (Exception ex) + { + logger.LogError(ex, "Project Years"); + } + } + } +} \ No newline at end of file diff --git a/console_spo_utils/Workers/MainWorker.cs b/console_spo_utils/Workers/MainWorker.cs index 29bf23e..d6ff267 100644 --- a/console_spo_utils/Workers/MainWorker.cs +++ b/console_spo_utils/Workers/MainWorker.cs @@ -20,7 +20,7 @@ namespace console_spo_utils.Workers protected override async Task ExecuteAsync(CancellationToken stoppingToken) { - var buildProjectsResult = structureBuilder.BuildProject("CT0019"); + var buildProjectsResult = structureBuilder.BuildProject("CT0000"); if (!buildProjectsResult) { @@ -28,7 +28,7 @@ namespace console_spo_utils.Workers return; } - var buildQuotationResult = structureBuilder.BuildQuotation("OF0003"); + var buildQuotationResult = structureBuilder.BuildQuotation("OF0001"); if (!buildQuotationResult) { @@ -37,35 +37,4 @@ namespace console_spo_utils.Workers } } } -} - - -//#region SPO Credential -//var siteCollection = "https://italsortbuttrio.sharepoint.com"; -//var svcUser = "svcItsSharePointAdmin@italsort.com"; -//var svcUserPsw = new NetworkCredential("", "$O,D1XBp1O5.OdjZt86#a=").SecurePassword; -//#endregion - -//#region General Variable -//var year = DateTime.Now.Year.ToString(); -//var tenantName = $"Commesse {year}"; -//var projectsYear = tenantName.Replace(" ", string.Empty); -//var listTitle = $"Lista {tenantName}"; -//var ssProjectTitle = "CT0018"; -//string[] ssSubProjectTitle = { $"{ssProjectTitle}-0001", $"{ssProjectTitle}-0002", $"{ssProjectTitle}-0003" }; - -//var site = new Uri($"{siteCollection}/sites/{projectsYear}"); -//var subSite = new Uri($"{siteCollection}/sites/{projectsYear}/{ssProjectTitle}"); -//#endregion - -//#region Create -//projectSiteService.CreateIfNotExists(listTitle, tenantName, svcUser, site, svcUserPsw); -//projectService.Create(siteCollection, svcUser, svcUserPsw, ssProjectTitle); -//subProjectService.Create(siteCollection, svcUser, svcUserPsw,ssProjectTitle, ssSubProjectTitle); -//#endregion - -//#region Create -//offerService.Create(siteCollection, svcUser, svcUserPsw); -//#endregion - -//return Task.CompletedTask; \ No newline at end of file +} \ No newline at end of file diff --git a/console_spo_utils/bin/Debug/net6.0/console_spo_utils.deps.json b/console_spo_utils/bin/Debug/net6.0/console_spo_utils.deps.json index f4be04a..128630a 100644 --- a/console_spo_utils/bin/Debug/net6.0/console_spo_utils.deps.json +++ b/console_spo_utils/bin/Debug/net6.0/console_spo_utils.deps.json @@ -14,6 +14,7 @@ "Microsoft.Extensions.Hosting.Abstractions": "6.0.0", "Microsoft.PowerPlatform.Dataverse.Client": "1.0.9", "Microsoft.SharePoint.Client": "14.0.4762.1000", + "Microsoft.SharePoint.Client.Online.CSOM": "15.0.4919.1000", "Microsoft.SharePointOnline.CSOM": "16.1.22615.12000", "PnP.Core": "1.7.0", "PnP.Core.Admin": "1.7.0", @@ -922,6 +923,53 @@ } }, "Microsoft.SharePoint.Client/14.0.4762.1000": {}, + "Microsoft.SharePoint.Client.Online.CSOM/15.0.4919.1000": { + "dependencies": { + "SharePoint.Client.Office.Tools": "15.0.4907.1000" + }, + "runtime": { + "lib/net40-full/Microsoft.SharePoint.ApplicationPages.Administration.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4907.1000" + }, + "lib/net40-full/Microsoft.SharePoint.ApplicationPages.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4911.1000" + }, + "lib/net40-full/Microsoft.SharePoint.Client.ServerRuntime.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4905.1000" + }, + "lib/net40-full/Microsoft.SharePoint.DesignTime.Activities.dll": { + "assemblyVersion": "14.0.0.0", + "fileVersion": "14.0.23928.0" + }, + "lib/net40-full/Microsoft.SharePoint.Portal.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4917.1000" + }, + "lib/net40-full/Microsoft.SharePoint.Publishing.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4907.1000" + }, + "lib/net40-full/Microsoft.SharePoint.Security.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4420.1017" + }, + "lib/net40-full/Microsoft.SharePoint.Taxonomy.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4911.1000" + }, + "lib/net40-full/Microsoft.SharePoint.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4919.1003" + }, + "lib/net40-full/Microsoft.Sharepoint.WorkflowActions.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4857.1000" + } + } + }, "Microsoft.SharePointOnline.CSOM/16.1.22615.12000": { "runtime": { "lib/netstandard2.0/Microsoft.Office.Client.Policy.dll": { @@ -1155,6 +1203,34 @@ "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {}, "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {}, "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {}, + "SharePoint.Client.Office.Tools/15.0.4907.1000": { + "runtime": { + "lib/net40-full/Microsoft.Office.Client.Education.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4420.1017" + }, + "lib/net40-full/Microsoft.Office.DocumentManagement.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4885.1000" + }, + "lib/net40-full/Microsoft.Office.Policy.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4891.1000" + }, + "lib/net40-full/Microsoft.Office.Server.Search.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4917.1000" + }, + "lib/net40-full/Microsoft.Office.Server.UserProfiles.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4907.1000" + }, + "lib/net40-full/Microsoft.Office.Server.dll": { + "assemblyVersion": "15.0.0.0", + "fileVersion": "15.0.4907.1000" + } + } + }, "SharePointPnP.IdentityModel.Extensions/1.2.4": { "dependencies": { "Microsoft.IdentityModel": "6.1.7600.16394" @@ -2642,6 +2718,13 @@ "path": "microsoft.sharepoint.client/14.0.4762.1000", "hashPath": "microsoft.sharepoint.client.14.0.4762.1000.nupkg.sha512" }, + "Microsoft.SharePoint.Client.Online.CSOM/15.0.4919.1000": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kwIePwIWVPOMwqoKco4if9ShzljUMFNVnAwqUw0uwCinIfinwLGuqoQIOWhKdnNdRBsTgaRkng7W8KLKFl/7/w==", + "path": "microsoft.sharepoint.client.online.csom/15.0.4919.1000", + "hashPath": "microsoft.sharepoint.client.online.csom.15.0.4919.1000.nupkg.sha512" + }, "Microsoft.SharePointOnline.CSOM/16.1.22615.12000": { "type": "package", "serviceable": true, @@ -2817,6 +2900,13 @@ "path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.2", "hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512" }, + "SharePoint.Client.Office.Tools/15.0.4907.1000": { + "type": "package", + "serviceable": true, + "sha512": "sha512-hqCDW9ObVOG+UTlLejHOiU3u/qA+gLI5egKHIPEvvinfwlyWy5NupqHCQne1WRFaZVxFGoW1QxkXh23mQ5KEXg==", + "path": "sharepoint.client.office.tools/15.0.4907.1000", + "hashPath": "sharepoint.client.office.tools.15.0.4907.1000.nupkg.sha512" + }, "SharePointPnP.IdentityModel.Extensions/1.2.4": { "type": "package", "serviceable": true, diff --git a/console_spo_utils/console_spo_utils.csproj b/console_spo_utils/console_spo_utils.csproj index ff77266..d5560b0 100644 --- a/console_spo_utils/console_spo_utils.csproj +++ b/console_spo_utils/console_spo_utils.csproj @@ -14,6 +14,7 @@ + diff --git a/console_spo_utils/obj/Debug/net6.0/console_spo_utils.csproj.FileListAbsolute.txt b/console_spo_utils/obj/Debug/net6.0/console_spo_utils.csproj.FileListAbsolute.txt index 0a518d7..e8628d5 100644 --- a/console_spo_utils/obj/Debug/net6.0/console_spo_utils.csproj.FileListAbsolute.txt +++ b/console_spo_utils/obj/Debug/net6.0/console_spo_utils.csproj.FileListAbsolute.txt @@ -189,3 +189,19 @@ C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\zh-TW\Hangfir C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\zh\Hangfire.Core.resources.dll C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Diagnostics.EventLog.Messages.dll C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Diagnostics.EventLog.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.ApplicationPages.Administration.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.ApplicationPages.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.ServerRuntime.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.DesignTime.Activities.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Portal.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Publishing.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Security.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Taxonomy.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Sharepoint.WorkflowActions.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Office.Client.Education.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Office.DocumentManagement.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Office.Policy.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Office.Server.Search.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Office.Server.UserProfiles.dll +C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Office.Server.dll diff --git a/console_spo_utils/obj/console_spo_utils.csproj.nuget.dgspec.json b/console_spo_utils/obj/console_spo_utils.csproj.nuget.dgspec.json index bc24458..8b13bc2 100644 --- a/console_spo_utils/obj/console_spo_utils.csproj.nuget.dgspec.json +++ b/console_spo_utils/obj/console_spo_utils.csproj.nuget.dgspec.json @@ -72,6 +72,10 @@ "target": "Package", "version": "[14.0.4762.1000, )" }, + "Microsoft.SharePoint.Client.Online.CSOM": { + "target": "Package", + "version": "[15.0.4919.1000, )" + }, "Microsoft.SharePointOnline.CSOM": { "target": "Package", "version": "[16.1.22615.12000, )" diff --git a/console_spo_utils/obj/project.assets.json b/console_spo_utils/obj/project.assets.json index 41c5721..1b7cf39 100644 --- a/console_spo_utils/obj/project.assets.json +++ b/console_spo_utils/obj/project.assets.json @@ -1268,6 +1268,56 @@ "lib/Microsoft.SharePoint.Client.dll": {} } }, + "Microsoft.SharePoint.Client.Online.CSOM/15.0.4919.1000": { + "type": "package", + "dependencies": { + "SharePoint.Client.Office.Tools": "15.0.4907.1000" + }, + "compile": { + "lib/net40-full/Microsoft.Online.SharePoint.Client.Tenant.dll": {}, + "lib/net40-full/Microsoft.SharePoint.ApplicationPages.Administration.dll": {}, + "lib/net40-full/Microsoft.SharePoint.ApplicationPages.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.DocumentManagement.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Publishing.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Runtime.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Search.Applications.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Search.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.ServerRuntime.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Taxonomy.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.UserProfiles.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.WorkflowServices.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.dll": {}, + "lib/net40-full/Microsoft.SharePoint.DesignTime.Activities.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Portal.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Publishing.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Security.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Taxonomy.dll": {}, + "lib/net40-full/Microsoft.SharePoint.dll": {}, + "lib/net40-full/Microsoft.Sharepoint.WorkflowActions.dll": {} + }, + "runtime": { + "lib/net40-full/Microsoft.Online.SharePoint.Client.Tenant.dll": {}, + "lib/net40-full/Microsoft.SharePoint.ApplicationPages.Administration.dll": {}, + "lib/net40-full/Microsoft.SharePoint.ApplicationPages.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.DocumentManagement.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Publishing.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Runtime.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Search.Applications.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Search.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.ServerRuntime.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.Taxonomy.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.UserProfiles.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.WorkflowServices.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Client.dll": {}, + "lib/net40-full/Microsoft.SharePoint.DesignTime.Activities.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Portal.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Publishing.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Security.dll": {}, + "lib/net40-full/Microsoft.SharePoint.Taxonomy.dll": {}, + "lib/net40-full/Microsoft.SharePoint.dll": {}, + "lib/net40-full/Microsoft.Sharepoint.WorkflowActions.dll": {} + } + }, "Microsoft.SharePointOnline.CSOM/16.1.22615.12000": { "type": "package", "compile": { @@ -1640,6 +1690,31 @@ } } }, + "SharePoint.Client.Office.Tools/15.0.4907.1000": { + "type": "package", + "compile": { + "lib/net40-full/Microsoft.Office.Client.Education.dll": {}, + "lib/net40-full/Microsoft.Office.Client.Policy.dll": {}, + "lib/net40-full/Microsoft.Office.Client.TranslationServices.dll": {}, + "lib/net40-full/Microsoft.Office.DocumentManagement.dll": {}, + "lib/net40-full/Microsoft.Office.Policy.dll": {}, + "lib/net40-full/Microsoft.Office.Server.Search.dll": {}, + "lib/net40-full/Microsoft.Office.Server.UserProfiles.dll": {}, + "lib/net40-full/Microsoft.Office.Server.dll": {}, + "lib/net40-full/Microsoft.Office.SharePoint.Tools.dll": {} + }, + "runtime": { + "lib/net40-full/Microsoft.Office.Client.Education.dll": {}, + "lib/net40-full/Microsoft.Office.Client.Policy.dll": {}, + "lib/net40-full/Microsoft.Office.Client.TranslationServices.dll": {}, + "lib/net40-full/Microsoft.Office.DocumentManagement.dll": {}, + "lib/net40-full/Microsoft.Office.Policy.dll": {}, + "lib/net40-full/Microsoft.Office.Server.Search.dll": {}, + "lib/net40-full/Microsoft.Office.Server.UserProfiles.dll": {}, + "lib/net40-full/Microsoft.Office.Server.dll": {}, + "lib/net40-full/Microsoft.Office.SharePoint.Tools.dll": {} + } + }, "SharePointPnP.IdentityModel.Extensions/1.2.4": { "type": "package", "dependencies": { @@ -4959,6 +5034,37 @@ "microsoft.sharepoint.client.nuspec" ] }, + "Microsoft.SharePoint.Client.Online.CSOM/15.0.4919.1000": { + "sha512": "kwIePwIWVPOMwqoKco4if9ShzljUMFNVnAwqUw0uwCinIfinwLGuqoQIOWhKdnNdRBsTgaRkng7W8KLKFl/7/w==", + "type": "package", + "path": "microsoft.sharepoint.client.online.csom/15.0.4919.1000", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/net40-full/Microsoft.Online.SharePoint.Client.Tenant.dll", + "lib/net40-full/Microsoft.SharePoint.ApplicationPages.Administration.dll", + "lib/net40-full/Microsoft.SharePoint.ApplicationPages.dll", + "lib/net40-full/Microsoft.SharePoint.Client.DocumentManagement.dll", + "lib/net40-full/Microsoft.SharePoint.Client.Publishing.dll", + "lib/net40-full/Microsoft.SharePoint.Client.Runtime.dll", + "lib/net40-full/Microsoft.SharePoint.Client.Search.Applications.dll", + "lib/net40-full/Microsoft.SharePoint.Client.Search.dll", + "lib/net40-full/Microsoft.SharePoint.Client.ServerRuntime.dll", + "lib/net40-full/Microsoft.SharePoint.Client.Taxonomy.dll", + "lib/net40-full/Microsoft.SharePoint.Client.UserProfiles.dll", + "lib/net40-full/Microsoft.SharePoint.Client.WorkflowServices.dll", + "lib/net40-full/Microsoft.SharePoint.Client.dll", + "lib/net40-full/Microsoft.SharePoint.DesignTime.Activities.dll", + "lib/net40-full/Microsoft.SharePoint.Portal.dll", + "lib/net40-full/Microsoft.SharePoint.Publishing.dll", + "lib/net40-full/Microsoft.SharePoint.Security.dll", + "lib/net40-full/Microsoft.SharePoint.Taxonomy.dll", + "lib/net40-full/Microsoft.SharePoint.dll", + "lib/net40-full/Microsoft.Sharepoint.WorkflowActions.dll", + "microsoft.sharepoint.client.online.csom.15.0.4919.1000.nupkg.sha512", + "microsoft.sharepoint.client.online.csom.nuspec" + ] + }, "Microsoft.SharePointOnline.CSOM/16.1.22615.12000": { "sha512": "AJiI7ApweC1HYmlJiMvB3tIjtK0kCZnDLbQk66JqqUERTTIaZdIk/wyzGmyACZ8ox1zhxkDy2IbLOoAi8K7n3g==", "type": "package", @@ -5464,6 +5570,26 @@ "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so" ] }, + "SharePoint.Client.Office.Tools/15.0.4907.1000": { + "sha512": "hqCDW9ObVOG+UTlLejHOiU3u/qA+gLI5egKHIPEvvinfwlyWy5NupqHCQne1WRFaZVxFGoW1QxkXh23mQ5KEXg==", + "type": "package", + "path": "sharepoint.client.office.tools/15.0.4907.1000", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/net40-full/Microsoft.Office.Client.Education.dll", + "lib/net40-full/Microsoft.Office.Client.Policy.dll", + "lib/net40-full/Microsoft.Office.Client.TranslationServices.dll", + "lib/net40-full/Microsoft.Office.DocumentManagement.dll", + "lib/net40-full/Microsoft.Office.Policy.dll", + "lib/net40-full/Microsoft.Office.Server.Search.dll", + "lib/net40-full/Microsoft.Office.Server.UserProfiles.dll", + "lib/net40-full/Microsoft.Office.Server.dll", + "lib/net40-full/Microsoft.Office.SharePoint.Tools.dll", + "sharepoint.client.office.tools.15.0.4907.1000.nupkg.sha512", + "sharepoint.client.office.tools.nuspec" + ] + }, "SharePointPnP.IdentityModel.Extensions/1.2.4": { "sha512": "/kFtJWkTXxlwNapdNGuvflYTcB3ODFUzt/PVDTNQQyfl7V7mnB+HrTuvlKfrWDHscx21Qavac9xVogG9nAptWA==", "type": "package", @@ -9862,6 +9988,7 @@ "Microsoft.Extensions.Hosting.Abstractions >= 6.0.0", "Microsoft.PowerPlatform.Dataverse.Client >= 1.0.9", "Microsoft.SharePoint.Client >= 14.0.4762.1000", + "Microsoft.SharePoint.Client.Online.CSOM >= 15.0.4919.1000", "Microsoft.SharePointOnline.CSOM >= 16.1.22615.12000", "PnP.Core >= 1.7.0", "PnP.Core.Admin >= 1.7.0", @@ -9943,6 +10070,10 @@ "target": "Package", "version": "[14.0.4762.1000, )" }, + "Microsoft.SharePoint.Client.Online.CSOM": { + "target": "Package", + "version": "[15.0.4919.1000, )" + }, "Microsoft.SharePointOnline.CSOM": { "target": "Package", "version": "[16.1.22615.12000, )" @@ -10089,6 +10220,26 @@ "net6.0" ] }, + { + "code": "NU1701", + "level": "Warning", + "warningLevel": 1, + "message": "Il pacchetto 'Microsoft.SharePoint.Client.Online.CSOM 15.0.4919.1000' è stato ripristinato mediante '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' e non mediante il framework di destinazione del progetto 'net6.0'. Questo pacchetto potrebbe non essere completamente compatibile con il progetto.", + "libraryId": "Microsoft.SharePoint.Client.Online.CSOM", + "targetGraphs": [ + "net6.0" + ] + }, + { + "code": "NU1701", + "level": "Warning", + "warningLevel": 1, + "message": "Il pacchetto 'SharePoint.Client.Office.Tools 15.0.4907.1000' è stato ripristinato mediante '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' e non mediante il framework di destinazione del progetto 'net6.0'. Questo pacchetto potrebbe non essere completamente compatibile con il progetto.", + "libraryId": "SharePoint.Client.Office.Tools", + "targetGraphs": [ + "net6.0" + ] + }, { "code": "NU1701", "level": "Warning",