Major Update

Defined structure of project
This commit is contained in:
Kalarumeth
2022-09-02 18:50:27 +02:00
parent 3295aea262
commit 924cdd3d4b
54 changed files with 4033 additions and 1330 deletions
+51
View File
@@ -0,0 +1,51 @@
namespace console_spo_utils.Constants;
public static class Fields
{
public static string[] SubProject
{
get
{
return new string[] { "Item", "Codice Articolo", "Descrizione Articolo", "Matricola Macchina" };
}
}
public static string[] SiteFields
{
get
{
return new[] { "ID Progetto", "Cliente", "Causale" };
}
}
public static Dictionary<string, string[]> ProjectCustomFields
{
get
{
return new Dictionary<string, string[]>()
{
{ "PAL_ID_Project", new string[] { "URL", "ID Progetto", "PAL Field", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_DlvReason", new string[] { "Choice", "Causale", "PAL Field", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "<CHOICES><CHOICE>01 VENDITA MACCHINE / IMPIANTI</CHOICE><CHOICE>02 VENDITA RICAMBI</CHOICE><CHOICE>04 VENDITA SERVIZI FUORI COMMESSA</CHOICE><CHOICE>08 VENDITA RIPARAZIONI</CHOICE><CHOICE>09 ENGINEERING</CHOICE><CHOICE>11 VENDITA E LAVORAZ.CONTO TERZI</CHOICE><CHOICE>55 PREVENDITE</CHOICE><CHOICE>NC NON CONFORMITÁ</CHOICE></CHOICES>" } },
{ "PAL_Customer", new string[] { "Text", "Cliente", "PAL Field", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Item", new string[] { "Text", "Item", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_ItemCode", new string[] { "Text", "Codice Articolo", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_ItemDescription", new string[] { "Text", "Descrizione Articolo", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_SerialNumber", new string[] { "Text", "Matricola Macchina", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
};
}
}
public static Dictionary<string, string[]> QuotationCustomFields
{
get
{
return new Dictionary<string, string[]>()
{
{ "PAL_Quotation_Reason", new string[] { "Choice", "Causale", "PAL Field", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", $"<CHOICES><CHOICE>01 VENDITA MACCHINE / IMPIANTI</CHOICE><CHOICE>02 VENDITA RICAMBI</CHOICE><CHOICE>04 VENDITA SERVIZI FUORI COMMESSA</CHOICE><CHOICE>08 VENDITA RIPARAZIONI</CHOICE><CHOICE>09 ENGINEERING</CHOICE><CHOICE>11 VENDITA E LAVORAZ.CONTO TERZI</CHOICE><CHOICE>55 PREVENDITE</CHOICE><CHOICE>NC NON CONFORMITÁ</CHOICE></CHOICES>" } },
{ "PAL_ID_Quotation", new string[] { "Text", "ID Offerta", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Quotation_Name", new string[] { "Text", "Fornitore", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Authors", new string[] { "Text", "Autore", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
};
}
}
}
+60
View File
@@ -0,0 +1,60 @@
using System.Collections;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Constants;
public static class Folders
{
public static Dictionary<string, string> GetProjectFolders(string projName)
{
var folderName = new Dictionary<string, string>
{
{ "01_Costificazioni", $"Commerciale {projName}" },
{ "02_Conferma_Ordine", $"Commerciale {projName}" },
{ "03_Amministrazione", $"Commerciale {projName}" },
{ "05_Documenti_di_Spedizione", $"Documenti {projName}" },
{ "07_Service", $"Documenti {projName}" },
{ "08_Specifiche_Tecniche_E_Meeting", $"Documenti {projName}" },
{ "10_Fornitori", $"Documenti {projName}" },
{ "11_Documenti_Tecnici", $"Documenti {projName}" }
};
return folderName;
}
public static Dictionary<string, string> GetProjectQuickMenu(string projName, string subSiteUrl)
{
var itemQuickMenu = new Dictionary<string, string>
{
{ $"Commerciale {projName}", $"{subSiteUrl}/Commerciale%20{projName}" },
{ $"Documenti {projName}", $"{subSiteUrl}/Documenti%20{projName}" },
{ $"Media {projName}", $"{subSiteUrl}/Media%20{projName}" },
{ $"SottoCommesse {projName}", $"{subSiteUrl}/SottoCommesse%20{projName}" }
};
return itemQuickMenu;
}
public static Dictionary<string, ListTemplateType> GetProjectDocLib(string ssProjectTitle)
{
var docLibNames = new Dictionary<string, ListTemplateType>
{
{ $"Documenti {ssProjectTitle}", ListTemplateType.DocumentLibrary },
{ $"Media {ssProjectTitle}", ListTemplateType.PictureLibrary },
{ $"SottoCommesse {ssProjectTitle}", ListTemplateType.DocumentLibrary },
{ $"Commerciale {ssProjectTitle}", ListTemplateType.DocumentLibrary },
};
return docLibNames;
}
public static IEnumerable SubProjectDocSet
{
get
{
return new string[]
{
"09_Documenti_Tecnici",
"12_Disegni_Costruttivi",
"13_Manuali",
"15_Documentazione_Elettrica",
"16_Liste_Ricambi"
};
}
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace console_spo_utils.Enums
{
public enum PalFieldType
{
Project,
Quotation
}
}
@@ -0,0 +1,16 @@
using console_spo_utils.Interfaces.Repositories;
namespace console_spo_utils.Fakes.Repositories;
public class FakeProjectSettingsRepository:IProjectSettingsRepository
{
public string DefaultDlvReason(string projName)
{
return "02 VENDITA RICAMBI";
}
public string DefaultCostumer(string projName)
{
return "PAL";
}
}
@@ -0,0 +1,17 @@
using console_spo_utils.Interfaces.Repositories;
namespace console_spo_utils.Fakes.Repositories;
public class FakeSubProjectRepository:ISubProjectRepository
{
public List<string> GetFromProject(string projName)
{
return new List<string>()
{
$"{projName}-001",
$"{projName}-002",
$"{projName}-003",
$"{projName}-004",
};
}
}
@@ -0,0 +1,7 @@
namespace console_spo_utils.Interfaces.Repositories;
public interface IProjectSettingsRepository
{
public string DefaultDlvReason(string projName);
public string DefaultCostumer(string projName);
}
@@ -0,0 +1,6 @@
namespace console_spo_utils.Interfaces.Repositories;
public interface ISubProjectRepository
{
public List<string> GetFromProject(string projName);
}
@@ -0,0 +1,10 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface IOneNoteService
{
public bool CreateFolderInsideProject(string projName, ClientContext ctx);
public bool CreateFolderInsideQuotation(string quotationName, ClientContext ctx);
public void EnableFeature(ClientContext ctx);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface IProjectDocLibraryService
{
void Create(string projName, ClientContext subSiteContext);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface IProjectQuickMenuService
{
void CreateForProject(string projNames, ClientContext subSiteContext);
}
@@ -0,0 +1,10 @@
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface IProjectYearService
{
public void ProjectsYList(string listTitle, ClientContext ctx);
}
@@ -0,0 +1,6 @@
namespace console_spo_utils.Interfaces.Services;
public interface IQuotationBuildService
{
void CreateIfNotExists(string quotationName);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface IQuotationDocLibraryService
{
public void Create(string libName, ClientContext ctx);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface IQuotationDocSetService
{
public void Create(string quotationName, string docLibraryName, string tenantName, ClientContext ctx);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface IRightsService
{
void DomainGroupRights(ClientContext ctx, string tenantName, string docLibName = "");
}
@@ -0,0 +1,10 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface ISharePointAuthenticationManager
{
ClientContext GetContext(Uri web);
Task<string> EnsureAccessTokenAsync(Uri resourceUri, string userPrincipalName, string userPassword);
void Dispose();
}
@@ -0,0 +1,15 @@
using console_spo_utils.Enums;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface ISharePointCustomOperation
{
bool SiteExist(ClientContext ctx);
bool ListExist(ClientContext ctx, string listTitle);
bool FolderExistsInsideList(ClientContext context, string listTitle, string folderName);
bool SiteFeaturesExist(ClientContext ctx, string featureName);
void PalCustomField(ClientContext ctx, PalFieldType et);
public bool ListContentTypeExist(ClientContext ctx, string listTitle, string contentTypeName);
}
@@ -0,0 +1,7 @@
namespace console_spo_utils.Interfaces.Services;
public interface ISharePointStructureBuilder
{
public bool BuildProject(string projName);
public bool BuildQuotation(string quotationName);
}
@@ -0,0 +1,24 @@
using System.Security;
namespace console_spo_utils.Interfaces.Services;
public interface ISiteOptions
{
public string TokenEndpoint { get; }
public string DefaultAadAppId { get; }
public Uri GetProjectSite();
public string GetProjTenant();
public string GetUser();
public SecureString GetPassword();
public string GetProjListTitle();
public Uri GetSubProjSite(string projName);
string GetQuotationTenant();
Uri GetQuotationSite();
string GetSubProjList(string projName);
public string GetQuotationLibrary();
}
@@ -0,0 +1,9 @@
namespace console_spo_utils.Interfaces.Services;
public interface ISiteService
{
public bool CreateProjectSiteIfNotExists();
public bool CreateSubSiteIfNotExists(string projName);
public bool CreateQuotationSiteIfNotExists();
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface ISubProjectBuilderService
{
bool SubProjectDocSet(string projName, List<string> subProjTitle);
}
@@ -0,0 +1,9 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
public interface ISubSiteService
{
bool Create(string projName, ClientContext siteContext);
void AddColumnsToListView(string projName, ClientContext subSiteContext);
}
@@ -0,0 +1,10 @@
using console_spo_utils.Enums;
using System.Security;
namespace console_spo_utils.Interfaces.Services;
public interface ITenantService
{
public void CreateForProject();
public void CreateForQuotation();
}
+11
View File
@@ -0,0 +1,11 @@
namespace console_spo_utils.Model
{
public class ParentProj
{
public string ProjId { get; set; }
public string Description { get; set; }
public string Customer { get; set; }
public string DeliveryReason { get; set; }
public List<SubProj> SubProjects { get; set; }
}
}
+15
View File
@@ -0,0 +1,15 @@
namespace console_spo_utils.Model
{
public class SubProj
{
public string ProjId { get; set; }
public string Description { get; set; }
public string Customer { get; set; }
public string DeliveryReason { get; set; }
public string Position { get; set; }
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public string SerialNumber { get; set; }
}
}
+7
View File
@@ -0,0 +1,7 @@
namespace console_spo_utils.Model
{
internal class TokenWaitInfo
{
public RegisteredWaitHandle Handle = null;
}
}
+60
View File
@@ -0,0 +1,60 @@
using System.Xml.Serialization;
namespace console_spo_utils.Model;
[XmlRoot(ElementName = "Field")]
public class XmlFieldsModel
{
[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<string> 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<string> fieldValue)
{
// var fieldXml = $"<Field Name='{f.Key}' Type='{f.Value[0]}' Description='' DisplayName='{f.Value[1]}' StaticName='{f.Key}' Group='{f.Value[2]}' Hidden='{f.Value[3]}' Required='{f.Value[4]}' Sealed='{f.Value[5]}' ShowInDisplayForm='{f.Value[6]}' ShowInEditForm='{f.Value[7]}' ShowInNewForm='{f.Value[8]}'>{f.Value[9]}</Field>";
return new XmlFieldsModel()
{
Name = fieldKey,
Type = fieldValue[0],
};
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
using console_spo_utils.Interfaces.Repositories;
namespace console_spo_utils.Repositories;
public class SubProjectRepository:ISubProjectRepository
{
public List<string> GetFromProject(string projName)
{
return new();
}
}
@@ -0,0 +1,209 @@
using console_spo_utils.Model;
using Microsoft.SharePoint.Client;
using System.Collections.Concurrent;
using System.Text;
using System.Text.Json;
using System.Web;
using Microsoft.Extensions.Logging;
using console_spo_utils.Interfaces.Services;
namespace console_spo_utils.Services
{
public sealed class SharePointAuthenticationManager : IDisposable, ISharePointAuthenticationManager
{
private readonly ILogger<SharePointAuthenticationManager> logger;
private readonly ISiteOptions siteOptions;
public SharePointAuthenticationManager(
ILogger<SharePointAuthenticationManager> logger,
ISiteOptions siteOptions)
{
this.logger = logger;
this.siteOptions = siteOptions;
}
private static readonly HttpClient HttpClient = new();
private static readonly SemaphoreSlim SemaphoreSlimTokens = new(1);
private AutoResetEvent tokenResetEvent = null;
private readonly ConcurrentDictionary<string, string> tokenCache = new();
private bool disposedValue;
#region CSOM
public ClientContext GetContext(Uri web)
{
var context = new ClientContext(web);
context.ExecutingWebRequest += (sender, e) =>
{
var accessToken = EnsureAccessTokenAsync(new Uri($"{web.Scheme}://{web.DnsSafeHost}"),
siteOptions.GetUser(),
new System.Net.NetworkCredential(string.Empty, siteOptions.GetPassword()).Password)
.GetAwaiter()
.GetResult();
e.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + accessToken;
};
return context;
}
public async Task<string> EnsureAccessTokenAsync(Uri resourceUri, string userPrincipalName, string userPassword)
{
var accessTokenFromCache = TokenFromCache(resourceUri, tokenCache);
if (accessTokenFromCache == null)
{
await SemaphoreSlimTokens.WaitAsync();
try
{
// No async methods are allowed in a lock section
var accessToken = await AcquireTokenAsync(resourceUri, userPrincipalName, userPassword);
logger.LogInformation($"Successfully requested new access token resource {resourceUri.DnsSafeHost} for user {userPrincipalName}");
AddTokenToCache(resourceUri, tokenCache, accessToken);
// Register a thread to invalidate the access token once's it's expired
tokenResetEvent = new AutoResetEvent(false);
var wi = new TokenWaitInfo();
wi.Handle = ThreadPool.RegisterWaitForSingleObject(
tokenResetEvent,
(state, timedOut) =>
{
if (!timedOut)
{
var internalWaitToken = (TokenWaitInfo)state;
if (internalWaitToken?.Handle is not null)
{
internalWaitToken.Handle.Unregister(null);
}
}
else
{
try
{
// Take a lock to ensure no other threads are updating the SharePoint Access token at this time
SemaphoreSlimTokens.Wait();
RemoveTokenFromCache(resourceUri, tokenCache);
logger.LogInformation($"Cached token for resource {resourceUri.DnsSafeHost} and user {userPrincipalName} expired");
}
catch (Exception ex)
{
logger.LogInformation($"Something went wrong during cache token invalidation: {ex.Message}");
RemoveTokenFromCache(resourceUri, tokenCache);
}
finally
{
SemaphoreSlimTokens.Release();
}
}
},
wi,
(uint)CalculateThreadSleep(accessToken).TotalMilliseconds,
true
);
return accessToken;
}
finally
{
SemaphoreSlimTokens.Release();
}
}
else
{
logger.LogInformation("OK - Execution Query");
return accessTokenFromCache;
}
}
private async Task<string> AcquireTokenAsync(Uri resourceUri, string username, string password)
{
var resource = $"{resourceUri.Scheme}://{resourceUri.DnsSafeHost}";
var clientId = siteOptions.DefaultAadAppId;
var body = $"resource={resource}&client_id={clientId}&grant_type=password&username={HttpUtility.UrlEncode(username)}&password={HttpUtility.UrlEncode(password)}";
using var stringContent = new StringContent(body, Encoding.UTF8, "application/x-www-form-urlencoded");
var result = await HttpClient.PostAsync(siteOptions.TokenEndpoint, stringContent).ContinueWith((response) =>
{
return response.Result.Content.ReadAsStringAsync().Result;
}).ConfigureAwait(false);
var tokenResult = JsonSerializer.Deserialize<JsonElement>(result);
var token = tokenResult.GetProperty("access_token").GetString();
return token;
}
private static string TokenFromCache(Uri web, ConcurrentDictionary<string, string> tokenCache)
{
if (tokenCache.TryGetValue(web.DnsSafeHost, out var accessToken))
{
return accessToken;
}
return null;
}
private static void AddTokenToCache(Uri web, ConcurrentDictionary<string, string> tokenCache, string newAccessToken)
{
if (tokenCache.TryGetValue(web.DnsSafeHost, out var currentAccessToken))
{
tokenCache.TryUpdate(web.DnsSafeHost, newAccessToken, currentAccessToken);
}
else
{
tokenCache.TryAdd(web.DnsSafeHost, newAccessToken);
}
}
private static void RemoveTokenFromCache(Uri web, ConcurrentDictionary<string, string> tokenCache)
{
tokenCache.TryRemove(web.DnsSafeHost, out _);
}
private static TimeSpan CalculateThreadSleep(string accessToken)
{
var token = new System.IdentityModel.Tokens.Jwt.JwtSecurityToken(accessToken);
var lease = GetAccessTokenLease(token.ValidTo);
lease = TimeSpan.FromSeconds(lease.TotalSeconds - TimeSpan.FromMinutes(5).TotalSeconds > 0 ? lease.TotalSeconds - TimeSpan.FromMinutes(5).TotalSeconds : lease.TotalSeconds);
return lease;
}
private static TimeSpan GetAccessTokenLease(DateTime expiresOn)
{
var now = DateTime.UtcNow;
var expires = expiresOn.Kind == DateTimeKind.Utc ? expiresOn : TimeZoneInfo.ConvertTimeToUtc(expiresOn);
var lease = expires - now;
return lease;
}
private void Dispose(bool disposing)
{
if (disposedValue)
{
return;
}
if (disposing)
{
if (tokenResetEvent is not null)
{
tokenResetEvent.Set();
tokenResetEvent.Dispose();
}
}
disposedValue = true;
}
public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
#endregion
}
}
+234
View File
@@ -0,0 +1,234 @@
//using Microsoft.SharePoint.Client.DocumentSet;
//using Microsoft.SharePoint.Client;
//using System.Security;
//using console_spo_utils.Enums;
//using Microsoft.AddSharePointExtensions.Logging;
//namespace console_spo_utils.Services
//{
// internal class OfferService
// {
// private readonly SharePointCustomOperation spc;
// private readonly ILogger logger;
// private readonly SharePointAuthenticationManager authMgr;
// public OfferService(
// SharePointCustomOperation spc,
// ILogger<OfferService> logger,
// SharePointAuthenticationManager authMgr)
// {
// this.spc = spc;
// this.logger = logger;
// this.authMgr = authMgr;
// }
// public void Create(string siteCollection, string user, SecureString psw)
// {
// var year = DateTime.Now.Year.ToString();
// var tenantName = "Offerte";
// var docLibName = $"{tenantName} {year}";
// var quotationName = $"OF0002";
// var site = new Uri($"{siteCollection}/sites/Offerte");
// var ctx = authMgr.GetContext(site);
// //spc.AddWebPart(ctx, "/sites/Offerte/SitePages/homepage.aspx");
// if (!spc.SiteExist(ctx))
// {
// spc.TenantCreation(tenantName, PalFieldType.Quotation, site, user, psw);
// }
// else if (spc.SiteExist(ctx) && spc.ListExist(ctx, docLibName) == false)
// {
// OfferDocLib(docLibName, ctx);
// }
// else if (spc.SiteExist(ctx) && spc.ListExist(ctx, docLibName) && !spc.FolderExistsInsideList(ctx, docLibName, quotationName))
// {
// OfferDocSet(quotationName, docLibName, tenantName, ctx);
// }
// }
// public void OfferDocLib(string docLibName, ClientContext ctx)
// {
// try
// {
// #region New DocLib
// logger.LogInformation($"> Inizializzata la fase di creazione '{docLibName}'.");
// var web = ctx.Web;
// ctx.Load(web, w => w.RootFolder.WelcomePage, w => w.Url);
// var lci = new ListCreationInformation
// {
// Title = docLibName,
// TemplateType = (int)ListTemplateType.DocumentLibrary
// };
// web.Lists.Add(lci);
// ctx.ExecuteQuery();
// logger.LogInformation($"> Completata la fase di creazione '{docLibName}'.");
// #endregion
// #region Field
// logger.LogInformation($"> Inizializzata la fase di importazione dei campi '{docLibName}'.");
// var list = ctx.Web.Lists.GetByTitle(docLibName);
// var siteField = ctx.Site.RootWeb;
// ctx.Load(list, l => l.Fields);
// ctx.Load(siteField, s => s.Fields);
// ctx.ExecuteQuery();
// string[] fieldName = { "ID Offerta", "Fornitore", "Causale", "Autore" };
// foreach (var fn in fieldName)
// {
// var fields = siteField.Fields.GetByTitle(fn);
// list.Fields.Add(fields);
// }
// ctx.ExecuteQuery();
// logger.LogInformation($"> Completata la fase di importazione dei campi '{docLibName}'.");
// #endregion
// #region View
// logger.LogInformation($"> Inizializzata la fase di creazione della ListView '{docLibName}'.");
// var views = list.Views;
// var viewCreation = new ViewCreationInformation
// {
// SetAsDefaultView = true,
// Title = docLibName,
// ViewTypeKind = ViewType.None,
// ColumnWidth = "350",
// ViewFields = new string[] { "Type", "Name", "ID Offerta", "Fornitore", "Causale", "Autore" }
// };
// var view = views.Add(viewCreation);
// ctx.Load(view);
// ctx.ExecuteQuery();
// logger.LogInformation($"> Completata la fase di creazione della ListView '{viewCreation.Title}'.");
// var customView = views.GetByTitle(viewCreation.Title);
// customView.MobileView = true;
// customView.MobileDefaultView = true;
// customView.Update();
// ctx.ExecuteQuery();
// logger.LogInformation($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'.");
// #endregion
// #region Shortcut on Quickmenu
// var spNavNodeColl = web.Navigation.QuickLaunch;
// var newNavNode = new NavigationNodeCreationInformation
// {
// Title = $"{docLibName}",
// Url = $"{web.Url}/{docLibName.Replace(" ", "%20")}",
// AsLastNode = true
// };
// spNavNodeColl.Add(newNavNode);
// ctx.ExecuteQuery();
// logger.LogInformation($"> Il menu rapido è stato aggiornato, il collegamemento a {docLibName} è ora disponibile.");
// #endregion
// }
// catch (Exception ex)
// {
// logger.LogError("Create Doc Lib", ex);
// }
// }
// public void OfferDocSet(string quotationName, string docLibName, string tenantName, ClientContext ctx) //TODO: add onenote on creation of
// {
// try
// {
// #region Context
// var web = ctx.Web;
// ctx.Load(web, w => w.Url);
// var list = web.Lists.GetByTitle(docLibName);
// ctx.Load(list, l => l.RootFolder, l => l.ContentTypes, l => l.Fields, l => l.ContentTypesEnabled);
// ctx.ExecuteQuery();
// list.ContentTypesEnabled = true;
// list.Update();
// if (spc.ListContentTypeExist(ctx, docLibName, "Set di documenti") == false)
// {
// var documentCt = ctx.Site.RootWeb.AvailableContentTypes.GetById("0x0120D5");
// ctx.Load(documentCt);
// ctx.ExecuteQuery();
// var ctDocSet = new ContentTypeCreationInformation()
// {
// Name = "Set di documenti",
// ParentContentType = documentCt
// };
// list.ContentTypes.Add(ctDocSet);
// list.Update();
// ctx.ExecuteQuery();
// }
// var ctData = list.ContentTypes.Where(c => c.Name == "Set di documenti");
// var contentType = ctData.FirstOrDefault();
// ctx.Load(contentType);
// ctx.ExecuteQuery();
// #endregion
// logger.LogInformation($"> Inizializzata la fase di creazione per {quotationName}.");
// #region DocSet Field Entry
// DocumentSet.Create(ctx, list.RootFolder, quotationName, contentType.Id);
// ctx.ExecuteQuery();
// logger.LogInformation($"> DocumentSet {quotationName} creata.");
// var dsItem = list.RootFolder.Folders.GetByUrl(quotationName).ListItemAllFields;
// dsItem["PAL_ID_Quotation"] = "valueItemCode";
// dsItem["PAL_Quotation_Name"] = "valueItemDescription";
// dsItem["PAL_Quotation_Reason"] = "NC NON CONFORMITÁ";
// dsItem["PAL_Authors"] = "Test";
// dsItem.Update();
// ctx.ExecuteQuery();
// logger.LogInformation($"> Field value update.");
// #endregion
// #region Quotation Folder
// var rev = "Rev. 1";
// string[] folderName = { rev, $"{rev}/01_Costificazione", $"{rev}/02_Offerta", $"{rev}/03_Meeting", $"{rev}/04_Corrispondenza", $"{rev}/08_Specifiche_Tecniche", $"{rev}/10_Fornitori", $"{rev}/11_Documenti_Tecnici", $"{rev}/14_Foto" };
// foreach (var name in folderName)
// {
// logger.LogInformation($"La sotto cartella {name} verrà creata in {quotationName}");
// var rPath = ResourcePath.FromDecodedUrl($"{quotationName}/{name}");
// list.RootFolder.AddSubFolderUsingPath(rPath);
// }
// ctx.ExecuteQuery();
// spc.OnenoteSPFeature(ctx, tenantName, quotationName);
// logger.LogInformation($"Le sotto cartelle sono state create con successo in {quotationName}");
// #endregion
// logger.LogInformation($"> {quotationName} creato con successo in Offerte/{docLibName}.");
// }
// catch (Exception ex)
// {
// logger.LogError("Create Doc Set", ex);
// }
// }
// }
//}
@@ -0,0 +1,91 @@
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
public class OneNoteService : IOneNoteService
{
private readonly ILogger<OneNoteService> logger;
private readonly ISiteOptions siteOptions;
private readonly ISharePointCustomOperation cpt;
public OneNoteService(
ILogger<OneNoteService> logger,
ISiteOptions siteOptions,
ISharePointCustomOperation cpt)
{
this.logger = logger;
this.siteOptions = siteOptions;
this.cpt = cpt;
}
public bool CreateFolderInsideProject(string projName, ClientContext ctx)
{
try
{
logger.LogInformation($"> Inizializzata la fase di creazione della sezione {projName} in OneNote.");
var list = ctx.Web.Lists.EnsureSiteAssetsLibrary();
ctx.Load(list, l => l.RootFolder);
ctx.ExecuteQuery();
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetProjTenant()} Notebook/{projName}");
list.RootFolder.AddSubFolderUsingPath(rPath);
ctx.ExecuteQuery();
logger.LogInformation($"> Completata la fase di creazione della sezione {projName} in OneNote.");
}
catch (Exception ex)
{
logger.LogError(ex, "OnenoteSPFeature");
return false;
}
return true;
}
public bool CreateFolderInsideQuotation(string quotationName, ClientContext ctx)
{
try
{
logger.LogInformation($"> Inizializzata la fase di creazione della sezione {quotationName} in OneNote.");
var list = ctx.Web.Lists.EnsureSiteAssetsLibrary();
ctx.Load(list, l => l.RootFolder);
ctx.ExecuteQuery();
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{quotationName}");
list.RootFolder.AddSubFolderUsingPath(rPath);
ctx.ExecuteQuery();
logger.LogInformation($"> Completata la fase di creazione della sezione {quotationName} in OneNote.");
}
catch (Exception ex)
{
logger.LogError(ex, "OnenoteSPFeature");
return false;
}
return true;
}
public void EnableFeature(ClientContext ctx)
{
var featureName = "SiteNotebook";
var featureId = new Guid("f151bb39-7c3b-414f-bb36-6bf18872052f");
#region Feature Activate
if (!cpt.SiteFeaturesExist(ctx, featureName))
{
ctx.Web.ActivateFeature(featureId);
ctx.ExecuteQuery();
logger.LogInformation($"> La Feature {featureName} è ora attiva!");
}
#endregion
}
}
@@ -0,0 +1,86 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
public class ProjectDocLibraryService : IProjectDocLibraryService
{
private readonly ILogger<ProjectDocLibraryService> logger;
private readonly IRightsService rightsService;
public ProjectDocLibraryService(
ILogger<ProjectDocLibraryService> logger,
IRightsService rightsService)
{
this.logger = logger;
this.rightsService = rightsService;
}
public void Create(string ssProjectTitle, ClientContext ctx) //TODO: Da testare
{
try
{
BuildProjectDocumentLibrary(ssProjectTitle, ctx);
BuildProjectFolders(ssProjectTitle, ctx);
}
catch (Exception ex)
{
logger.LogError(ex, "Create Doc Lib");
}
}
private void BuildProjectFolders(string projName, ClientContext clientContext)
{
var projectFolders = Folders.GetProjectFolders(projName);
foreach (var (folderName, folderPath) in projectFolders)
{
logger.LogInformation($"> Inizializzata la fase di {folderName} in {folderPath}.");
var list = clientContext.Web.Lists.GetByTitle(folderPath);
var info = new ListItemCreationInformation
{
UnderlyingObjectType = FileSystemObjectType.Folder,
LeafName = folderName
};
var newItem = list.AddItem(info);
newItem["Title"] = folderName;
newItem.Update();
clientContext.ExecuteQuery();
logger.LogInformation($"> {folderName} creato con successo in {folderPath}.");
}
}
private void BuildProjectDocumentLibrary(string projName, ClientContext clientContext)
{
var docLibNames = Folders.GetProjectDocLib(projName);
foreach (var (libraryName, libraryType) in docLibNames)
{
logger.LogInformation($"> Inizializzata la fase di creazione '{libraryName}'.");
var web = clientContext.Web;
clientContext.Load(web);
var lci = new ListCreationInformation
{
Title = libraryName,
TemplateType = (int)libraryType
};
web.Lists.Add(lci);
clientContext.ExecuteQuery();
if (libraryName.Contains("Commerciale"))
{
rightsService.DomainGroupRights(clientContext, string.Empty, libraryName);
}
logger.LogInformation($"> '{libraryName}' è stato creato con successo.");
}
}
}
@@ -0,0 +1,61 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
public class ProjectQuickMenuService : IProjectQuickMenuService
{
private readonly ILogger<ProjectQuickMenuService> logger;
private readonly ISiteOptions siteOptions;
public ProjectQuickMenuService(ILogger<ProjectQuickMenuService> logger
, ISiteOptions siteOptions)
{
this.logger = logger;
this.siteOptions = siteOptions;
}
public void CreateForProject(string projName, ClientContext ctx)
{
try
{
var subSiteUrl = siteOptions.GetSubProjSite(projName).ToString();
var itemQuickMenu = Folders.GetProjectQuickMenu(projName, subSiteUrl);
var spNavNodeColl = ctx.Web.Navigation.QuickLaunch;
var newNavNode = new NavigationNodeCreationInformation();
ctx.Load(ctx.Web, w => w.RootFolder.WelcomePage);
foreach (var (name, path) in itemQuickMenu)
{
newNavNode.Title = name;
newNavNode.Url = path;
newNavNode.AsLastNode = true;
spNavNodeColl.Add(newNavNode);
ctx.ExecuteQuery();
logger.LogInformation($"> Il menu rapido è stato aggiornato in {projName}");
if (name != $"SottoCommesse {projName}")
{
continue;
}
ctx.Web.RootFolder.WelcomePage = $"SottoCommesse%20{projName}/Forms/SottoCommesse%20{projName}.aspx";
ctx.Web.RootFolder.Update();
ctx.ExecuteQuery();
}
}
catch (Exception ex)
{
logger.LogError(ex, "CreateForProject");
}
}
}
@@ -0,0 +1,122 @@
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
public class ProjectYearService:IProjectYearService
{
private readonly ILogger<ProjectYearService> logger;
public ProjectYearService(
ILogger<ProjectYearService> logger)
{
this.logger = logger;
}
public void ProjectsYList(string listTitle, ClientContext ctx)
{
try
{
#region New List
Console.WriteLine($"> Inizializzata la fase di creazione della lista '{listTitle}'.");
Web web = ctx.Web;
ListCreationInformation creationInfo = new ListCreationInformation();
creationInfo.Title = listTitle;
creationInfo.TemplateType = (int)ListTemplateType.GenericList;
List oList = web.Lists.Add(creationInfo);
ctx.ExecuteQuery();
ctx.Load(oList, l => l.Fields);
var fld = oList.Fields.GetByInternalNameOrTitle("Title");
if (fld != null)
{
fld.Required = false;
fld.SetShowInDisplayForm(false);
fld.SetShowInEditForm(false);
fld.SetShowInNewForm(false);
oList.Update();
ctx.ExecuteQuery();
}
Console.WriteLine($"> La lista '{listTitle}' è stato creato con successo.");
#endregion
#region Field
Console.WriteLine($"> Inizializzata la fase di importazione dei campi '{listTitle}'.");
List list = ctx.Web.Lists.GetByTitle(listTitle);
var siteField = ctx.Site.RootWeb;
ctx.Load(list, l => l.Fields);
ctx.Load(siteField, s => s.Fields);
ctx.ExecuteQuery();
string[] fieldName = { "ID Progetto", "Cliente", "Causale" };
foreach (var fn in fieldName)
{
var Fields = siteField.Fields.GetByTitle(fn);
list.Fields.Add(Fields);
}
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di importazione dei campi '{listTitle}'.");
#endregion
#region View
Console.WriteLine($"> Inizializzata la fase di creazione della ListView '{listTitle}'.");
var views = list.Views;
ViewCreationInformation viewCreation = new ViewCreationInformation();
viewCreation.SetAsDefaultView = true;
viewCreation.Title = listTitle;
viewCreation.ViewTypeKind = ViewType.None;
viewCreation.ColumnWidth = "350";
viewCreation.ViewFields = new string[] { "ID Progetto", "Cliente", "Causale" };
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.MobileDefaultView = true;
customView.Update();
ctx.ExecuteQuery();
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}'");
#endregion
}
catch (Exception ex)
{
logger.LogError(ex,"Project Years");
}
}
}
@@ -0,0 +1,57 @@
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
namespace console_spo_utils.Services;
public class QuotationBuildService : IQuotationBuildService
{
private readonly ISiteOptions siteOptions;
private readonly ISharePointAuthenticationManager sharePointAuthenticationManager;
private readonly ISharePointCustomOperation spc;
private readonly ITenantService tenantService;
private readonly IQuotationDocLibraryService quotationDocLibraryService;
private readonly IQuotationDocSetService quotationDocSetService;
private readonly ILogger<QuotationBuildService> logger;
public QuotationBuildService(
ISiteOptions siteOptions,
ISharePointAuthenticationManager sharePointAuthenticationManager,
ISharePointCustomOperation spc,
ITenantService tenantService,
IQuotationDocLibraryService quotationDocLibraryService,
IQuotationDocSetService quotationDocSetService,
ILogger<QuotationBuildService> logger)
{
this.siteOptions = siteOptions;
this.sharePointAuthenticationManager = sharePointAuthenticationManager;
this.spc = spc;
this.tenantService = tenantService;
this.quotationDocLibraryService = quotationDocLibraryService;
this.quotationDocSetService = quotationDocSetService;
this.logger = logger;
}
public void CreateIfNotExists(string quotationName)
{
var site = siteOptions.GetQuotationSite();
var ctx = sharePointAuthenticationManager.GetContext(site);
var list = siteOptions.GetQuotationLibrary();
var tenant = siteOptions.GetQuotationTenant();
if (!spc.SiteExist(ctx))
{
tenantService.CreateForQuotation();
}
else if (!spc.ListExist(ctx, list))
{
quotationDocLibraryService.Create(list, ctx);
}
else if (!spc.FolderExistsInsideList(ctx, list, quotationName))
{
quotationDocSetService.Create(quotationName, list, tenant, ctx);
}
else
{
logger.LogInformation($"Quotation with {quotationName} already exist");
}
}
}
@@ -0,0 +1,115 @@
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
public class QuotationDocLibraryService : IQuotationDocLibraryService
{
private readonly ILogger<QuotationDocLibraryService> logger;
public QuotationDocLibraryService(
ILogger<QuotationDocLibraryService> logger)
{
this.logger = logger;
}
public void Create(string libName, ClientContext ctx)
{
try
{
#region New DocLib
Console.WriteLine($"> Inizializzata la fase di creazione '{libName}'.");
Web web = ctx.Web;
ctx.Load(web, w => w.RootFolder.WelcomePage, w => w.Url);
ListCreationInformation lci = new ListCreationInformation();
lci.Title = libName;
lci.TemplateType = (int)ListTemplateType.DocumentLibrary;
web.Lists.Add(lci);
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di creazione '{libName}'.");
#endregion
#region Field
Console.WriteLine($"> Inizializzata la fase di importazione dei campi '{libName}'.");
List list = ctx.Web.Lists.GetByTitle(libName);
var siteField = ctx.Site.RootWeb;
ctx.Load(list, l => l.Fields);
ctx.Load(siteField, s => s.Fields);
ctx.ExecuteQuery();
string[] fieldName = { "ID Offerta", "Fornitore", "Causale", "Autore" };
foreach (var fn in fieldName)
{
var Fields = siteField.Fields.GetByTitle(fn);
list.Fields.Add(Fields);
}
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di importazione dei campi '{libName}'.");
#endregion
#region View
Console.WriteLine($"> Inizializzata la fase di creazione della ListView '{libName}'.");
var views = list.Views;
ViewCreationInformation viewCreation = new ViewCreationInformation();
viewCreation.SetAsDefaultView = true;
viewCreation.Title = libName;
viewCreation.ViewTypeKind = ViewType.None;
viewCreation.ColumnWidth = "350";
viewCreation.ViewFields = new string[] { "Type", "Name", "ID Offerta", "Fornitore", "Causale", "Autore" };
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.MobileDefaultView = true;
customView.Update();
ctx.ExecuteQuery();
Console.WriteLine($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'.");
#endregion
#region Shortcut on Quickmenu
NavigationNodeCollection spNavNodeColl = web.Navigation.QuickLaunch;
NavigationNodeCreationInformation newNavNode = new NavigationNodeCreationInformation();
newNavNode.Title = $"{libName}";
newNavNode.Url = $"{web.Url}/{libName.Replace(" ", "%20")}";
newNavNode.AsLastNode = true;
spNavNodeColl.Add(newNavNode);
ctx.ExecuteQuery();
Console.WriteLine($"> Il menu rapido è stato aggiornato, il collegamemento a {libName} è ora disponibile.");
#endregion
}
catch (Exception ex)
{
logger.LogError(ex, "");
}
}
}
@@ -0,0 +1,116 @@
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.DocumentSet;
namespace console_spo_utils.Services;
public class QuotationDocSetService : IQuotationDocSetService
{
private readonly ISharePointCustomOperation cpt;
private readonly ILogger<QuotationDocSetService> logger;
private readonly IOneNoteService oneNoteService;
public QuotationDocSetService(ISharePointCustomOperation cpt,
ILogger<QuotationDocSetService> logger,
IOneNoteService oneNoteService)
{
this.cpt = cpt;
this.logger = logger;
this.oneNoteService = oneNoteService;
}
public void Create(string quotationName, string docLibraryName, string tenantName, ClientContext ctx)
{
try
{
#region Context
var web = ctx.Web;
ctx.Load(web, w => w.Url);
List list = web.Lists.GetByTitle(docLibraryName);
ctx.Load(list, l => l.RootFolder, l => l.ContentTypes, l => l.Fields, l => l.ContentTypesEnabled);
ctx.ExecuteQuery();
list.ContentTypesEnabled = true;
list.Update();
if (!cpt.ListContentTypeExist(ctx, docLibraryName, "Set di documenti"))
{
var documentCT = ctx.Site.RootWeb.AvailableContentTypes.GetById("0x0120D5");
ctx.Load(documentCT);
ctx.ExecuteQuery();
var ctDocSet = new ContentTypeCreationInformation()
{
Name = "Set di documenti",
ParentContentType = documentCT
};
list.ContentTypes.Add(ctDocSet);
list.Update();
ctx.ExecuteQuery();
}
var ctData = list.ContentTypes.Where(c => c.Name == "Set di documenti");
var contentType = ctData.FirstOrDefault();
ctx.Load(contentType);
ctx.ExecuteQuery();
#endregion
Console.WriteLine($"> Inizializzata la fase di creazione per {quotationName}.");
#region DocSet Field Entry
DocumentSet.Create(ctx, list.RootFolder, quotationName, contentType.Id);
ctx.ExecuteQuery();
Console.WriteLine($"> DocumentSet {quotationName} creata.");
var dsItem = list.RootFolder.Folders.GetByUrl(quotationName).ListItemAllFields;
dsItem["PAL_ID_Quotation"] = "valueItemCode";
dsItem["PAL_Quotation_Name"] = "valueItemDescription";
dsItem["PAL_Quotation_Reason"] = "NC NON CONFORMITÁ";
dsItem["PAL_Authors"] = "Test";
dsItem.Update();
ctx.ExecuteQuery();
Console.WriteLine($"> Field value update.");
#endregion
#region Quotation Folder
string rev = "Rev. 1";
string[] folderName =
{
rev, $"{rev}/01_Costificazione", $"{rev}/02_Offerta", $"{rev}/03_Meeting", $"{rev}/04_Corrispondenza",
$"{rev}/08_Specifiche_Tecniche", $"{rev}/10_Fornitori", $"{rev}/11_Documenti_Tecnici", $"{rev}/14_Foto"
};
foreach (string name in folderName)
{
Console.WriteLine($"La sotto cartella {name} verrà creata in {quotationName}");
var rPath = ResourcePath.FromDecodedUrl($"{quotationName}/{name}");
list.RootFolder.AddSubFolderUsingPath(rPath);
}
ctx.ExecuteQuery();
oneNoteService.CreateFolderInsideQuotation(quotationName, ctx);
Console.WriteLine($"Le sotto cartelle sono state create con successo in {quotationName}");
#endregion
Console.WriteLine($"> {quotationName} creato con successo in Offerte/{docLibraryName}.");
}
catch (Exception ex)
{
logger.LogError(ex, "");
}
}
}
+118
View File
@@ -0,0 +1,118 @@
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services
{
public class RightsService : IRightsService
{
private readonly ILogger<RightsService> logger;
public RightsService(ILogger<RightsService> logger)
{
this.logger = logger;
}
#region Rights
public void DomainGroupRights(ClientContext ctx, string tenantName, string docLibName = "")
{
#region Groups & Privileges
var itsAdGroupDictionary = new Dictionary<string, string>()
{
{ "ITS-SPO-PROJ-OWNER", "Full Control" },
{ "ITS-SPO-PROJ-DESIGN", "Design" },
{ "ITS-SPO-PROJ-MODIFY", "Edit" },
{ "ITS-SPO-PROJ-COLLABORATE", "Contribute" },
{ "ITS-SPO-PROJ-READ", "Read" }
};
var itsAdGruopSalesRole = new Dictionary<string, string>()
{
{ "ITS-SPO-PROJ-OWNER", "Full Control" },
{ "ITS-SPO-PROJ-SALES-MODIFY", "Edit" },
{ "ITS-SPO-PROJ-SALES-READ", "Read" }
};
#endregion
logger.LogInformation("> Inizializzata la fase di assegnazione dei ruoli.");
try
{
if (tenantName.Contains("Commesse"))
{
#region Site Permission Create
var web = ctx.Web;
foreach (var role in itsAdGroupDictionary)
{
var adGroup = web.EnsureUser(role.Key);
ctx.Load(adGroup);
var roleD = web.RoleDefinitions.GetByName(role.Value);
var roleDb = new RoleDefinitionBindingCollection(ctx) { roleD };
web.RoleAssignments.Add(adGroup, roleDb);
web.Update();
}
ctx.ExecuteQuery();
logger.LogInformation("> Completata la fase di assegnazione dei ruoli.");
#endregion
}
else if (tenantName.Contains("Offerte"))
{
#region Site Permission Quotation
var web = ctx.Web;
foreach (var role in itsAdGruopSalesRole)
{
var adGroup = web.EnsureUser(role.Key);
ctx.Load(adGroup);
var roleD = web.RoleDefinitions.GetByName(role.Value);
var roleDb = new RoleDefinitionBindingCollection(ctx) { roleD };
web.RoleAssignments.Add(adGroup, roleDb);
web.Update();
}
ctx.ExecuteQuery();
logger.LogInformation("> Completata la fase di assegnazione dei ruoli.");
#endregion
}
else if (!string.IsNullOrEmpty(docLibName))
{
#region DocLib Permission
var web = ctx.Web;
var list = web.Lists.GetByTitle(docLibName);
ctx.Load(list);
list.BreakRoleInheritance(false, true);
ctx.ExecuteQuery();
foreach (var role in itsAdGruopSalesRole)
{
var adGroup = web.EnsureUser(role.Key);
ctx.Load(adGroup);
var roleD = web.RoleDefinitions.GetByName(role.Value);
var roleDb = new RoleDefinitionBindingCollection(ctx) { roleD };
list.RoleAssignments.Add(adGroup, roleDb);
list.Update();
}
ctx.ExecuteQuery();
logger.LogInformation($"> Completata la fase di assegnazione dei ruoli in {docLibName}.");
#endregion
}
}
catch (Exception ex)
{
logger.LogError("Rights Service", ex);
}
}
#endregion
}
}
@@ -0,0 +1,160 @@
using console_spo_utils.Enums;
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using System.Security;
using System.Xml.Linq;
using console_spo_utils.Constants;
namespace console_spo_utils.Services
{
public class SharePointCustomOperation : ISharePointCustomOperation
{
private readonly ILogger logger;
private readonly IRightsService rightsService;
private readonly ISharePointAuthenticationManager authMgr;
public SharePointCustomOperation(
ILogger<SharePointCustomOperation> logger,
IRightsService rightsService,
ISharePointAuthenticationManager authMgr)
{
this.logger = logger;
this.rightsService = rightsService;
this.authMgr = authMgr;
}
#region Check If Exist
public bool SiteExist(ClientContext ctx)
{
try
{
var web = ctx.Web;
ctx.Load(web, w => w.Title);
ctx.ExecuteQuery();
return true;
}
catch (Exception ex)
{
logger.LogError("Site Exists", ex);
return false;
}
}
public bool ListExist(ClientContext ctx, string listTitle)
{
try
{
var targetList = ctx.Web.Lists.GetByTitle(listTitle);
ctx.ExecuteQuery();
return true;
}
catch (Exception ex)
{
logger.LogError("List Exist", ex);
return false;
}
}
public bool FolderExistsInsideList(ClientContext context, string listTitle, string folderName)
{
var folderExists = context.Web.Lists.GetByTitle(listTitle).RootFolder;
context.Load(folderExists, f => f.Folders);
try
{
context.ExecuteQuery();
if (folderExists.Folders.Any(fn => fn.Name == folderName))
{
return true;
}
return false;
}
catch (Exception ex)
{
logger.LogError("Folder Exists Inside List", ex);
return false;
}
}
public bool SiteFeaturesExist(ClientContext ctx, string featureName)
{
var web = ctx.Web;
var wFeatures = web.Features;
ctx.Load(web);
ctx.Load(wFeatures);
ctx.ExecuteQuery();
foreach (var wFeature in wFeatures)
{
ctx.Load(wFeature, wf => wf.DisplayName);
ctx.ExecuteQuery();
logger.LogInformation(wFeature.DisplayName);
if (wFeature.DisplayName == featureName) return true;
}
return false;
}
#endregion
public bool ListContentTypeExist(ClientContext ctx, string listTitle, string contentTypeName)
{
ContentTypeCollection cntCollection = ctx.Web.Lists.GetByTitle(listTitle).ContentTypes;
ctx.Load(cntCollection, cntyp => cntyp.Include(ct => ct.Name).Where(ct => ct.Name == contentTypeName));
ctx.ExecuteQuery();
if (!cntCollection.Any())
{
Console.WriteLine(cntCollection.Count);
return false;
}
else
{
Console.WriteLine(cntCollection.Count);
return true;
}
}
public void PalCustomField(ClientContext ctx, PalFieldType et)
{
var fieldList = et switch
{
PalFieldType.Project => Fields.ProjectCustomFields,
PalFieldType.Quotation => Fields.QuotationCustomFields,
_ => throw new NotImplementedException("Entity type not found")
};
try
{
var site = ctx.Site;
ctx.Load(site, w => w.RootWeb, w => w.RootWeb.Fields);
ctx.ExecuteQuery();
foreach (var f in fieldList)
{
var fieldXml = $"<Field Name='{f.Key}' Type='{f.Value[0]}' Description='' DisplayName='{f.Value[1]}' StaticName='{f.Key}' Group='{f.Value[2]}' Hidden='{f.Value[3]}' Required='{f.Value[4]}' Sealed='{f.Value[5]}' ShowInDisplayForm='{f.Value[6]}' ShowInEditForm='{f.Value[7]}' ShowInNewForm='{f.Value[8]}'>{f.Value[9]}</Field>";
site.RootWeb.Fields.AddFieldAsXml(fieldXml, false, AddFieldOptions.AddToDefaultContentType);
ctx.Load(site.RootWeb.Fields);
}
ctx.ExecuteQuery();
}
catch (Exception ex)
{
logger.LogError("PalCustomField", ex);
}
}
}
}
@@ -0,0 +1,63 @@
using System.Linq.Expressions;
using console_spo_utils.Interfaces.Repositories;
using console_spo_utils.Interfaces.Services;
namespace console_spo_utils.Services;
public class SharePointStructureBuilderService : ISharePointStructureBuilder
{
private readonly ISiteService siteService;
private readonly ISubProjectRepository subProjectRepository;
private readonly ISubProjectBuilderService subProjectBuilderService;
private readonly IQuotationBuildService quotationBuildService;
public SharePointStructureBuilderService(
ISiteService siteService,
ISubProjectRepository subProjectRepository,
ISubProjectBuilderService subProjectBuilderService,
IQuotationBuildService quotationBuildService)
{
this.siteService = siteService;
this.subProjectRepository = subProjectRepository;
this.subProjectBuilderService = subProjectBuilderService;
this.quotationBuildService = quotationBuildService;
}
public bool BuildProject(string projName)
{
var siteBuilderResult = siteService.CreateProjectSiteIfNotExists();
if (!siteBuilderResult)
{
throw new Exception($"Impossibile to build site");
}
var subSiteBuilderResult = siteService.CreateSubSiteIfNotExists(projName);
if (!subSiteBuilderResult)
{
throw new Exception($"Impossibile to build subSite for {projName} ");
}
var subProjects = subProjectRepository.GetFromProject(projName);
var subProjectBuilderResult = subProjectBuilderService.SubProjectDocSet(projName, subProjects);
if (!subProjectBuilderResult)
{
throw new Exception($"Impossibile to build subSite for {projName} ");
}
return true;
}
public bool BuildQuotation(string quotationName)
{
var siteBuildResult = siteService.CreateQuotationSiteIfNotExists();
if (!siteBuildResult)
{
throw new Exception($"Impossibile to build site");
}
quotationBuildService.CreateIfNotExists(quotationName);
return true;
}
}
+67
View File
@@ -0,0 +1,67 @@
using System.Net;
using System.Security;
using console_spo_utils.Interfaces.Services;
namespace console_spo_utils.Services;
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()
{
return new Uri($"{SiteCollection}/sites/{GetProjTenant().Replace(" ","")}");
}
private static int GetYear()
{
return DateTime.Today.Year +1;
}
public string GetProjTenant()
{
return $"Commesse {GetYear()}";
}
public string GetUser()
{
return "svcItsSharePointAdmin@italsort.com";
}
public SecureString GetPassword()
{
return new NetworkCredential("", "$O,D1XBp1O5.OdjZt86#a=").SecurePassword;
}
public string GetProjListTitle()
{
return $"Lista {GetProjTenant()}";
}
public Uri GetSubProjSite(string projName)
{
return new Uri($"{GetProjectSite()}/{projName}");
}
public string GetQuotationTenant()
{
return "Offerte";
}
public string GetQuotationLibrary()
{
return $"Offerte {GetYear()}";
}
public Uri GetQuotationSite()
{
return new Uri($"{SiteCollection}/sites/Offerte");
}
public string GetSubProjList(string projName)
{
return $"SottoCommesse {projName}";
}
}
+165
View File
@@ -0,0 +1,165 @@
using console_spo_utils.Enums;
using console_spo_utils.Interfaces.Repositories;
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
public class SiteService : ISiteService
{
private readonly ILogger<SiteService> logger;
private readonly ISharePointAuthenticationManager authMgr;
private readonly ISharePointCustomOperation spc;
private readonly ISiteOptions siteOptions;
private readonly ISubSiteService subSiteService;
private readonly IOneNoteService oneNoteService;
private readonly IProjectSettingsRepository projectSettingsRepository;
private readonly IProjectDocLibraryService projectDocLibraryService;
private readonly IProjectQuickMenuService projectQuickMenuService;
private readonly ITenantService tenantService;
private readonly IProjectYearService projectYearService;
public SiteService(
ILogger<SiteService> logger,
ISharePointAuthenticationManager authMgr,
ISharePointCustomOperation spc,
ISiteOptions siteOptions,
ISubSiteService subSiteService,
IOneNoteService oneNoteService,
IProjectSettingsRepository projectSettingsRepository,
IProjectDocLibraryService projectDocLibraryService,
IProjectQuickMenuService projectQuickMenuService,
ITenantService tenantService,
IProjectYearService projectYearService)
{
this.logger = logger;
this.authMgr = authMgr;
this.spc = spc;
this.siteOptions = siteOptions;
this.subSiteService = subSiteService;
this.oneNoteService = oneNoteService;
this.projectSettingsRepository = projectSettingsRepository;
this.projectDocLibraryService = projectDocLibraryService;
this.projectQuickMenuService = projectQuickMenuService;
this.tenantService = tenantService;
this.projectYearService = projectYearService;
}
public bool CreateProjectSiteIfNotExists()
{
try
{
var site = siteOptions.GetProjectSite();
var listTitle = siteOptions.GetProjListTitle();
using var ctx = authMgr.GetContext(site);
if (spc.SiteExist(ctx))
{
return true;
}
tenantService.CreateForProject();
projectYearService.ProjectsYList(listTitle,ctx);
}
catch (Exception e)
{
logger.LogError(e, "Site Service");
return false;
}
return true;
}
public bool CreateSubSiteIfNotExists(string projName)
{
var projectSite = siteOptions.GetProjectSite();
var subProjSite = siteOptions.GetSubProjSite(projName);
var siteContext = authMgr.GetContext(projectSite);
var subSiteContext = authMgr.GetContext(subProjSite);
if (!spc.SiteExist(siteContext))
{
throw new Exception($"Site {siteContext.Url} not exists");
}
if (spc.SiteExist(subSiteContext))
{
logger.LogInformation($"The subsite {subSiteContext.Url} already exists");
return true;
}
var existSubSite = subSiteService.Create(projName, siteContext);
if (!existSubSite)
{
return true;
}
oneNoteService.CreateFolderInsideProject(projName, siteContext);
CreateProjectListEntry(projName, siteContext);
projectDocLibraryService.Create(projName, subSiteContext);
subSiteService.AddColumnsToListView(projName, subSiteContext);
projectQuickMenuService.CreateForProject(projName, subSiteContext);
return true;
}
public bool CreateQuotationSiteIfNotExists()
{
try
{
var site = siteOptions.GetQuotationSite();
using var ctx = authMgr.GetContext(site);
if (spc.SiteExist(ctx))
{
return true;
}
tenantService.CreateForQuotation();
}
catch (Exception e)
{
logger.LogError(e, "Site Service");
return false;
}
return true;
}
private void CreateProjectListEntry(string projName, ClientContext ctx) //TODO: PP var
{
try
{
var listTitle = siteOptions.GetProjListTitle();
var tenant = siteOptions.GetProjTenant().Replace(" ","");
var list = ctx.Web.Lists.GetByTitle(listTitle);
var itemCreateInfo = new ListItemCreationInformation();
var oItem = list.AddItem(itemCreateInfo);
var link = new FieldUrlValue
{
Url = $"/sites/{tenant}/{projName}",
Description = projName
};
oItem["PAL_ID_Project"] = link;
oItem["PAL_Customer"] = projectSettingsRepository.DefaultCostumer(projName);
oItem["PAL_DlvReason"] = projectSettingsRepository.DefaultDlvReason(projName);
oItem.Update();
ctx.ExecuteQuery();
logger.LogInformation($"> La Commessa {projName} è stata aggiunta alla lista {listTitle} con successo!");
}
catch (Exception ex)
{
logger.LogError(ex, "Create List Entry");
}
}
}
@@ -0,0 +1,126 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client.DocumentSet;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
public class SubProjectBuilderService : ISubProjectBuilderService
{
private readonly ISiteOptions siteOptions;
private readonly ISharePointCustomOperation cpt;
private readonly ISharePointAuthenticationManager authMgr;
private readonly ILogger<SubProjectBuilderService> logger;
public SubProjectBuilderService(ISiteOptions siteOptions
, ISharePointCustomOperation cpt
, ISharePointAuthenticationManager authMgr,
ILogger<SubProjectBuilderService> logger)
{
this.siteOptions = siteOptions;
this.cpt = cpt;
this.authMgr = authMgr;
this.logger = logger;
}
public bool SubProjectDocSet(string projName, List<string> subProjTitle)
{
try
{
#region Context
var listTitle = siteOptions.GetSubProjList(projName);
var subSite = siteOptions.GetSubProjSite(projName);
var ctx = authMgr.GetContext(subSite);
var web = ctx.Web;
ctx.Load(web, w => w.Url);
var list = web.Lists.GetByTitle(listTitle);
ctx.Load(list, l => l.RootFolder, l => l.ContentTypes, l => l.Fields, l => l.ContentTypesEnabled);
ctx.ExecuteQuery();
list.ContentTypesEnabled = true;
list.Update();
if (cpt.ListContentTypeExist(ctx, listTitle, "Set di documenti") == false)
{
var documentCT = ctx.Site.RootWeb.AvailableContentTypes.GetById("0x0120D5");
ctx.Load(documentCT);
ctx.ExecuteQuery();
var ctDocSet = new ContentTypeCreationInformation()
{
Name = "Set di documenti",
ParentContentType = documentCT
};
list.ContentTypes.Add(ctDocSet);
list.Update();
ctx.ExecuteQuery();
}
var ctData = list.ContentTypes.Where(c => c.Name == "Set di documenti");
var contentType = ctData.FirstOrDefault();
ctx.Load(contentType);
ctx.ExecuteQuery();
#endregion
foreach (var spt in subProjTitle)
{
if (cpt.FolderExistsInsideList(ctx, listTitle, spt) == false)
{
Console.WriteLine($"> Inizializzata la fase di creazione per {spt}.");
#region DocSet Field Entry
DocumentSet.Create(ctx, list.RootFolder, spt, contentType.Id);
ctx.ExecuteQuery();
Console.WriteLine($"> DocumentSet {spt} creata.");
var dsItem = list.RootFolder.Folders.GetByUrl(spt).ListItemAllFields;
dsItem["_ExtendedDescription"] = "valueDescription";
dsItem["PAL_Item"] = "valueItem";
dsItem["PAL_ItemCode"] = "valueItemCode";
dsItem["PAL_ItemDescription"] = "valueItemDescription";
dsItem["PAL_SerialNumber"] = "valueSerialNumber";
dsItem.Update();
ctx.ExecuteQuery();
Console.WriteLine($"> Field value update.");
#endregion
#region SubProject Folder
foreach (var name in Folders.SubProjectDocSet)
{
Console.WriteLine($"La sotto cartella {name} verrà creata in {spt}");
var rPath = ResourcePath.FromDecodedUrl($"{spt}/{name}");
list.RootFolder.AddSubFolderUsingPath(rPath);
}
ctx.ExecuteQuery();
Console.WriteLine($"Le sotto cartelle sono state create con successo in {spt}");
#endregion
Console.WriteLine($"> {spt} creato con successo in SottoCommesse {projName}.");
}
}
}
catch (Exception ex)
{
logger.LogError(ex,"Sub Proj Doc Set");
return false;
}
return true;
}
}
@@ -0,0 +1,114 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
public class SubSiteService : ISubSiteService
{
private readonly ILogger<SubSiteService> logger;
public SubSiteService(ILogger<SubSiteService> logger)
{
this.logger = logger;
}
public bool Create(string projName, ClientContext siteContext)
{
try
{
logger.LogInformation($"> Il sito {projName} è in fase di creazione!");
var wci = new WebCreationInformation
{
Url = projName,
Title = projName,
UseSamePermissionsAsParentSite = true,
WebTemplate = "SITEPAGEPUBLISHING#0"
};
var web = siteContext.Site.RootWeb.Webs.Add(wci);
siteContext.ExecuteQuery();
logger.LogInformation($"> Il sito {projName} è stato creato con successo!");
}
catch (Exception ex)
{
logger.LogError("Create Sub Site", ex);
return false;
}
return true;
}
public void AddColumnsToListView(string ssProjectTitle, ClientContext ctx)
{
try
{
var listTitle = $"SottoCommesse {ssProjectTitle}";
#region Field
logger.LogInformation($"> Inizializzata la fase di importazione dei campi in 'SottoCommesse {ssProjectTitle}'.");
var web = ctx.Web;
var list = web.Lists.GetByTitle(listTitle);
var siteField = ctx.Site.RootWeb;
ctx.Load(list, l => l.Fields);
ctx.Load(siteField, s => s.Fields);
ctx.ExecuteQuery();
AddFieldsToSubProj(siteField, list, ctx);
logger.LogInformation($"> Completata la fase di importazione dei campi in 'SottoCommesse {ssProjectTitle}'.");
#endregion
#region View
logger.LogInformation($"> Inizializzata la fase di creazione della ListView '{listTitle}'.");
var views = list.Views;
var viewCreation = new ViewCreationInformation
{
SetAsDefaultView = true,
Title = listTitle,
ViewTypeKind = ViewType.None,
ColumnWidth = "350",
ViewFields = new string[] { "Type", "Name", "Description", "Item", "Codice Articolo", "Descrizione Articolo", "Matricola Macchina", "Modified", "Editor", "Version", }
};
var view = views.Add(viewCreation);
ctx.Load(view);
ctx.ExecuteQuery();
logger.LogInformation($"> Completata la fase di creazione della ListView '{viewCreation.Title}'.");
var customView = views.GetByTitle(viewCreation.Title);
customView.MobileView = true;
customView.MobileDefaultView = true;
customView.Update();
ctx.ExecuteQuery();
logger.LogInformation($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'.");
#endregion
}
catch (Exception ex)
{
logger.LogError("Create Sub Site", ex);
}
}
private static void AddFieldsToSubProj(Web siteField, List list, ClientContext ctx)
{
foreach (var fieldName in Fields.SubProject)
{
var fields = siteField.Fields.GetByTitle(fieldName);
list.Fields.Add(fields);
}
ctx.ExecuteQuery();
}
}
+101
View File
@@ -0,0 +1,101 @@
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.Online.SharePoint.TenantAdministration;
using System.Security;
using console_spo_utils.Enums;
namespace console_spo_utils.Services;
public class TenantService : ITenantService
{
private readonly ISharePointAuthenticationManager authMgr;
private readonly ISharePointCustomOperation cpt;
private readonly IRightsService rightsService;
private readonly IOneNoteService oneNoteService;
private readonly ILogger<TenantService> logger;
private readonly ISiteOptions siteOptions;
public TenantService(
ISharePointAuthenticationManager authMgr,
ISharePointCustomOperation cpt,
IRightsService rightsService,
IOneNoteService oneNoteService,
ILogger<TenantService> logger,
ISiteOptions siteOptions)
{
this.authMgr = authMgr;
this.cpt = cpt;
this.rightsService = rightsService;
this.oneNoteService = oneNoteService;
this.logger = logger;
this.siteOptions = siteOptions;
}
public void CreateForProject()
{
TenantCreation(
siteOptions.GetProjTenant(),
siteOptions.GetProjectSite(),
PalFieldType.Project
);
}
public void CreateForQuotation()
{
TenantCreation(
siteOptions.GetQuotationTenant(),
siteOptions.GetQuotationSite(),
PalFieldType.Quotation
);
}
public void TenantCreation(string tenantName, Uri site,PalFieldType fieldType)
{
Console.WriteLine($"> Inizializzata la fase di creazione del sito '../{tenantName.Replace(" ", string.Empty)}'.");
string siteAdmin = "https://italsortbuttrio-admin.sharepoint.com";
Uri path = new Uri(siteAdmin);
var tenantCtx = authMgr.GetContext(path);
var ctx = authMgr.GetContext(site);
try
{
var tenant = new Tenant(tenantCtx);
var scp = new SiteCreationProperties
{
Url = site.ToString(),
Title = tenantName,
Owner = siteOptions.GetUser(),
Template = "SITEPAGEPUBLISHING#0"
};
SpoOperation spo = tenant.CreateSite(scp);
tenantCtx.Load(tenant);
tenantCtx.Load(spo, i => i.IsComplete);
tenantCtx.ExecuteQuery();
while (!spo.IsComplete)
{
Console.WriteLine($"Il sito '../{scp.Title}' è in fase di pubblicazione.");
System.Threading.Thread.Sleep(30000);
spo.RefreshLoad();
tenantCtx.ExecuteQuery();
}
Console.WriteLine($"> Il sito è stato creato con successo. ({site})");
rightsService.DomainGroupRights(ctx, tenantName, string.Empty);
oneNoteService.EnableFeature(ctx);
cpt.PalCustomField(ctx,fieldType);
}
catch (Exception ex)
{
logger.LogError(ex,"Tenant Creation");
}
}
}
+65
View File
@@ -0,0 +1,65 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using console_spo_utils.Interfaces.Services;
namespace console_spo_utils.Workers
{
internal class MainWorker : BackgroundService
{
private readonly ISharePointStructureBuilder structureBuilder;
private readonly ILogger<MainWorker> logger;
public MainWorker(
ISharePointStructureBuilder structureBuilder,
ILogger<MainWorker> logger)
{
this.structureBuilder = structureBuilder;
this.logger = logger;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var buildResult = structureBuilder.BuildProject("CT2025");
if (!buildResult)
{
logger.LogError("Impossible to create structure");
return;
}
//#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;
}
}
}
@@ -8,7 +8,10 @@
".NETCoreApp,Version=v6.0": {
"console_spo_utils/1.0.0": {
"dependencies": {
"Hangfire.Core": "1.7.31",
"Microsoft.AspNetCore.Components.WebAssembly.Authentication": "6.0.8",
"Microsoft.Extensions.Hosting": "6.0.1",
"Microsoft.Extensions.Hosting.Abstractions": "6.0.0",
"Microsoft.PowerPlatform.Dataverse.Client": "1.0.9",
"Microsoft.SharePoint.Client": "14.0.4762.1000",
"Microsoft.SharePointOnline.CSOM": "16.1.22615.12000",
@@ -33,6 +36,58 @@
}
}
},
"Hangfire.Core/1.7.31": {
"dependencies": {
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"lib/netstandard2.0/Hangfire.Core.dll": {
"assemblyVersion": "1.7.31.0",
"fileVersion": "1.7.31.0"
}
},
"resources": {
"lib/netstandard2.0/ca/Hangfire.Core.resources.dll": {
"locale": "ca"
},
"lib/netstandard2.0/de/Hangfire.Core.resources.dll": {
"locale": "de"
},
"lib/netstandard2.0/es/Hangfire.Core.resources.dll": {
"locale": "es"
},
"lib/netstandard2.0/fa/Hangfire.Core.resources.dll": {
"locale": "fa"
},
"lib/netstandard2.0/fr/Hangfire.Core.resources.dll": {
"locale": "fr"
},
"lib/netstandard2.0/nb/Hangfire.Core.resources.dll": {
"locale": "nb"
},
"lib/netstandard2.0/nl/Hangfire.Core.resources.dll": {
"locale": "nl"
},
"lib/netstandard2.0/pt-BR/Hangfire.Core.resources.dll": {
"locale": "pt-BR"
},
"lib/netstandard2.0/pt-PT/Hangfire.Core.resources.dll": {
"locale": "pt-PT"
},
"lib/netstandard2.0/pt/Hangfire.Core.resources.dll": {
"locale": "pt"
},
"lib/netstandard2.0/tr-TR/Hangfire.Core.resources.dll": {
"locale": "tr-TR"
},
"lib/netstandard2.0/zh-TW/Hangfire.Core.resources.dll": {
"locale": "zh-TW"
},
"lib/netstandard2.0/zh/Hangfire.Core.resources.dll": {
"locale": "zh"
}
}
},
"Microsoft.ApplicationInsights/2.16.0": {
"dependencies": {
"System.Diagnostics.DiagnosticSource": "6.0.0"
@@ -325,6 +380,18 @@
}
}
},
"Microsoft.Extensions.Configuration/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.Primitives": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Configuration.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Configuration.Abstractions/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "6.0.0"
@@ -336,6 +403,85 @@
}
}
},
"Microsoft.Extensions.Configuration.Binder/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Configuration.Binder.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Configuration.CommandLine/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "6.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Configuration.CommandLine.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Configuration.EnvironmentVariables/6.0.1": {
"dependencies": {
"Microsoft.Extensions.Configuration": "6.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Configuration.EnvironmentVariables.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.222.6406"
}
}
},
"Microsoft.Extensions.Configuration.FileExtensions/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "6.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0",
"Microsoft.Extensions.FileProviders.Physical": "6.0.0",
"Microsoft.Extensions.Primitives": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Configuration.FileExtensions.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Configuration.Json/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "6.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "6.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0",
"System.Text.Json": "6.0.2"
},
"runtime": {
"lib/netstandard2.1/Microsoft.Extensions.Configuration.Json.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Configuration.UserSecrets/6.0.1": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.Configuration.Json": "6.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0",
"Microsoft.Extensions.FileProviders.Physical": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.222.6406"
}
}
},
"Microsoft.Extensions.DependencyInjection/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
@@ -356,6 +502,82 @@
}
}
},
"Microsoft.Extensions.FileProviders.Abstractions/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "6.0.0"
},
"runtime": {
"lib/net6.0/Microsoft.Extensions.FileProviders.Abstractions.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.FileProviders.Physical/6.0.0": {
"dependencies": {
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0",
"Microsoft.Extensions.FileSystemGlobbing": "6.0.0",
"Microsoft.Extensions.Primitives": "6.0.0"
},
"runtime": {
"lib/net6.0/Microsoft.Extensions.FileProviders.Physical.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.FileSystemGlobbing/6.0.0": {
"runtime": {
"lib/net6.0/Microsoft.Extensions.FileSystemGlobbing.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Hosting/6.0.1": {
"dependencies": {
"Microsoft.Extensions.Configuration": "6.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.Configuration.Binder": "6.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "6.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "6.0.1",
"Microsoft.Extensions.Configuration.FileExtensions": "6.0.0",
"Microsoft.Extensions.Configuration.Json": "6.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "6.0.1",
"Microsoft.Extensions.DependencyInjection": "6.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0",
"Microsoft.Extensions.FileProviders.Physical": "6.0.0",
"Microsoft.Extensions.Hosting.Abstractions": "6.0.0",
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Logging.Abstractions": "6.0.1",
"Microsoft.Extensions.Logging.Configuration": "6.0.0",
"Microsoft.Extensions.Logging.Console": "6.0.0",
"Microsoft.Extensions.Logging.Debug": "6.0.0",
"Microsoft.Extensions.Logging.EventLog": "6.0.0",
"Microsoft.Extensions.Logging.EventSource": "6.0.0",
"Microsoft.Extensions.Options": "6.0.0"
},
"runtime": {
"lib/net6.0/Microsoft.Extensions.Hosting.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.222.6406"
}
}
},
"Microsoft.Extensions.Hosting.Abstractions/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0"
},
"runtime": {
"lib/netstandard2.1/Microsoft.Extensions.Hosting.Abstractions.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Http/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
@@ -393,6 +615,85 @@
}
}
},
"Microsoft.Extensions.Logging.Configuration/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "6.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.Configuration.Binder": "6.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Logging.Abstractions": "6.0.1",
"Microsoft.Extensions.Options": "6.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Logging.Configuration.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Logging.Console/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Logging.Abstractions": "6.0.1",
"Microsoft.Extensions.Logging.Configuration": "6.0.0",
"Microsoft.Extensions.Options": "6.0.0",
"System.Text.Json": "6.0.2"
},
"runtime": {
"lib/net6.0/Microsoft.Extensions.Logging.Console.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Logging.Debug/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Logging.Abstractions": "6.0.1"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Logging.Debug.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Logging.EventLog/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Logging.Abstractions": "6.0.1",
"Microsoft.Extensions.Options": "6.0.0",
"System.Diagnostics.EventLog": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Logging.EventLog.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Logging.EventSource/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Logging.Abstractions": "6.0.1",
"Microsoft.Extensions.Options": "6.0.0",
"Microsoft.Extensions.Primitives": "6.0.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Json": "6.0.2"
},
"runtime": {
"lib/net6.0/Microsoft.Extensions.Logging.EventSource.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.ObjectPool/5.0.10": {
"runtime": {
"lib/net5.0/Microsoft.Extensions.ObjectPool.dll": {
@@ -413,6 +714,21 @@
}
}
},
"Microsoft.Extensions.Options.ConfigurationExtensions/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.Configuration.Binder": "6.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Options": "6.0.0",
"Microsoft.Extensions.Primitives": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Primitives/6.0.0": {
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
@@ -942,6 +1258,28 @@
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.EventLog/6.0.0": {
"runtime": {
"lib/net6.0/System.Diagnostics.EventLog.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
},
"runtimeTargets": {
"runtimes/win/lib/net6.0/System.Diagnostics.EventLog.Messages.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "6.0.0.0",
"fileVersion": "0.0.0.0"
},
"runtimes/win/lib/net6.0/System.Diagnostics.EventLog.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"System.Diagnostics.Tools/4.3.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "2.0.0",
@@ -1856,6 +2194,13 @@
"path": "anglesharp/0.14.0",
"hashPath": "anglesharp.0.14.0.nupkg.sha512"
},
"Hangfire.Core/1.7.31": {
"type": "package",
"serviceable": true,
"sha512": "sha512-2SthlIUr2NgFMPQteHZ8SRWj9A8MT0fDcT8D2gSZdVlvb+kvj+250hXOJMm2z/eQoCa0pJ0qFyy8Npxa/JfFiA==",
"path": "hangfire.core/1.7.31",
"hashPath": "hangfire.core.1.7.31.nupkg.sha512"
},
"Microsoft.ApplicationInsights/2.16.0": {
"type": "package",
"serviceable": true,
@@ -1996,6 +2341,13 @@
"path": "microsoft.extensions.caching.memory/6.0.0",
"hashPath": "microsoft.extensions.caching.memory.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tq2wXyh3fL17EMF2bXgRhU7JrbO3on93MRKYxzz4JzzvuGSA1l0W3GI9/tl8EO89TH+KWEymP7bcFway6z9fXg==",
"path": "microsoft.extensions.configuration/6.0.0",
"hashPath": "microsoft.extensions.configuration.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Abstractions/6.0.0": {
"type": "package",
"serviceable": true,
@@ -2003,6 +2355,48 @@
"path": "microsoft.extensions.configuration.abstractions/6.0.0",
"hashPath": "microsoft.extensions.configuration.abstractions.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Binder/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-b3ErKzND8LIC7o08QAVlKfaEIYEvLJbtmVbFZVBRXeu9YkKfSSzLZfR1SUfQPBIy9mKLhEtJgGYImkcMNaKE0A==",
"path": "microsoft.extensions.configuration.binder/6.0.0",
"hashPath": "microsoft.extensions.configuration.binder.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.CommandLine/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-3nL1qCkZ1Oxx14ZTzgo4MmlO7tso7F+TtMZAY2jUAtTLyAcDp+EDjk3RqafoKiNaePyPvvlleEcBxh3b2Hzl1g==",
"path": "microsoft.extensions.configuration.commandline/6.0.0",
"hashPath": "microsoft.extensions.configuration.commandline.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables/6.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pnyXV1LFOsYjGveuC07xp0YHIyGq7jRq5Ncb5zrrIieMLWVwgMyYxcOH0jTnBedDT4Gh1QinSqsjqzcieHk1og==",
"path": "microsoft.extensions.configuration.environmentvariables/6.0.1",
"hashPath": "microsoft.extensions.configuration.environmentvariables.6.0.1.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.FileExtensions/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-V4Dth2cYMZpw3HhGw9XUDIijpI6gN+22LDt0AhufIgOppCUfpWX4483OmN+dFXRJkJLc8Tv0Q8QK+1ingT2+KQ==",
"path": "microsoft.extensions.configuration.fileextensions/6.0.0",
"hashPath": "microsoft.extensions.configuration.fileextensions.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Json/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-GJGery6QytCzS/BxJ96klgG9in3uH26KcUBbiVG/coNDXCRq6LGVVlUT4vXq34KPuM+R2av+LeYdX9h4IZOCUg==",
"path": "microsoft.extensions.configuration.json/6.0.0",
"hashPath": "microsoft.extensions.configuration.json.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.UserSecrets/6.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Fy8yr4V6obi7ZxvKYI1i85jqtwMq8tqyxQVZpRSkgeA8enqy/KvBIMdcuNdznlxQMZa72mvbHqb7vbg4Pyx95w==",
"path": "microsoft.extensions.configuration.usersecrets/6.0.1",
"hashPath": "microsoft.extensions.configuration.usersecrets.6.0.1.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection/6.0.0": {
"type": "package",
"serviceable": true,
@@ -2017,6 +2411,41 @@
"path": "microsoft.extensions.dependencyinjection.abstractions/6.0.0",
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileProviders.Abstractions/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-0pd4/fho0gC12rQswaGQxbU34jOS1TPS8lZPpkFCH68ppQjHNHYle9iRuHeev1LhrJ94YPvzcRd8UmIuFk23Qw==",
"path": "microsoft.extensions.fileproviders.abstractions/6.0.0",
"hashPath": "microsoft.extensions.fileproviders.abstractions.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileProviders.Physical/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-QvkL7l0nM8udt3gfyu0Vw8bbCXblxaKOl7c2oBfgGy4LCURRaL9XWZX1FWJrQc43oMokVneVxH38iz+bY1sbhg==",
"path": "microsoft.extensions.fileproviders.physical/6.0.0",
"hashPath": "microsoft.extensions.fileproviders.physical.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileSystemGlobbing/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ip8jnL1aPiaPeKINCqaTEbvBFDmVx9dXQEBZ2HOBRXPD1eabGNqP/bKlsIcp7U2lGxiXd5xIhoFcmY8nM4Hdiw==",
"path": "microsoft.extensions.filesystemglobbing/6.0.0",
"hashPath": "microsoft.extensions.filesystemglobbing.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Hosting/6.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-hbmizc9KPWOacLU8Z8YMaBG6KWdZFppczYV/KwnPGU/8xebWxQxdDeJmLOgg968prb7g2oQgnp6JVLX6lgby8g==",
"path": "microsoft.extensions.hosting/6.0.1",
"hashPath": "microsoft.extensions.hosting.6.0.1.nupkg.sha512"
},
"Microsoft.Extensions.Hosting.Abstractions/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-GcT5l2CYXL6Sa27KCSh0TixsRfADUgth+ojQSD5EkzisZxmGFh7CwzkcYuGwvmXLjr27uWRNrJ2vuuEjMhU05Q==",
"path": "microsoft.extensions.hosting.abstractions/6.0.0",
"hashPath": "microsoft.extensions.hosting.abstractions.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Http/6.0.0": {
"type": "package",
"serviceable": true,
@@ -2038,6 +2467,41 @@
"path": "microsoft.extensions.logging.abstractions/6.0.1",
"hashPath": "microsoft.extensions.logging.abstractions.6.0.1.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Configuration/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ZDskjagmBAbv+K8rYW9VhjPplhbOE63xUD0DiuydZJwt15dRyoqicYklLd86zzeintUc7AptDkHn+YhhYkYo8A==",
"path": "microsoft.extensions.logging.configuration/6.0.0",
"hashPath": "microsoft.extensions.logging.configuration.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Console/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-gsqKzOEdsvq28QiXFxagmn1oRB9GeI5GgYCkoybZtQA0IUb7QPwf1WmN3AwJeNIsadTvIFQCiVK0OVIgKfOBGg==",
"path": "microsoft.extensions.logging.console/6.0.0",
"hashPath": "microsoft.extensions.logging.console.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Debug/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-M9g/JixseSZATJE9tcMn9uzoD4+DbSglivFqVx8YkRJ7VVPmnvCEbOZ0AAaxsL1EKyI4cz07DXOOJExxNsUOHw==",
"path": "microsoft.extensions.logging.debug/6.0.0",
"hashPath": "microsoft.extensions.logging.debug.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.EventLog/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-rlo0RxlMd0WtLG3CHI0qOTp6fFn7MvQjlrCjucA31RqmiMFCZkF8CHNbe8O7tbBIyyoLGWB1he9CbaA5iyHthg==",
"path": "microsoft.extensions.logging.eventlog/6.0.0",
"hashPath": "microsoft.extensions.logging.eventlog.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.EventSource/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-BeDyyqt7nkm/nr+Gdk+L8n1tUT/u33VkbXAOesgYSNsxDM9hJ1NOBGoZfj9rCbeD2+9myElI6JOVVFmnzgeWQA==",
"path": "microsoft.extensions.logging.eventsource/6.0.0",
"hashPath": "microsoft.extensions.logging.eventsource.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.ObjectPool/5.0.10": {
"type": "package",
"serviceable": true,
@@ -2052,6 +2516,13 @@
"path": "microsoft.extensions.options/6.0.0",
"hashPath": "microsoft.extensions.options.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Options.ConfigurationExtensions/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-bXWINbTn0vC0FYc9GaQTISbxhQLAMrvtbuvD9N6JelEaIS/Pr62wUCinrq5bf1WRBGczt1v4wDhxFtVFNcMdUQ==",
"path": "microsoft.extensions.options.configurationextensions/6.0.0",
"hashPath": "microsoft.extensions.options.configurationextensions.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Primitives/6.0.0": {
"type": "package",
"serviceable": true,
@@ -2416,6 +2887,13 @@
"path": "system.diagnostics.diagnosticsource/6.0.0",
"hashPath": "system.diagnostics.diagnosticsource.6.0.0.nupkg.sha512"
},
"System.Diagnostics.EventLog/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-lcyUiXTsETK2ALsZrX+nWuHSIQeazhqPphLfaRxzdGaG93+0kELqpgEHtwWOlQe7+jSFnKwaCAgL4kjeZCQJnw==",
"path": "system.diagnostics.eventlog/6.0.0",
"hashPath": "system.diagnostics.eventlog.6.0.0.nupkg.sha512"
},
"System.Diagnostics.Tools/4.3.0": {
"type": "package",
"serviceable": true,
+10 -1
View File
@@ -4,11 +4,14 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hangfire.Core" Version="1.7.31" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.8" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.PowerPlatform.Dataverse.Client" Version="1.0.9" />
<PackageReference Include="Microsoft.SharePoint.Client" Version="14.0.4762.1000" />
<PackageReference Include="Microsoft.SharePointOnline.CSOM" Version="16.1.22615.12000" />
@@ -19,4 +22,10 @@
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Fakes\Repositories\" />
<Folder Include="Fakes\Services\" />
<Folder Include="Repositories\" />
</ItemGroup>
</Project>
@@ -154,3 +154,38 @@ C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\runtimes\unix
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Drawing.Common.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Security.Cryptography.ProtectedData.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Windows.Extensions.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Hangfire.Core.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.Binder.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.CommandLine.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.FileExtensions.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.Json.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.UserSecrets.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.FileProviders.Abstractions.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.FileProviders.Physical.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.FileSystemGlobbing.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Hosting.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Hosting.Abstractions.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.Configuration.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.Console.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.Debug.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.EventLog.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.EventSource.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\System.Diagnostics.EventLog.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\ca\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\de\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\es\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\fa\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\fr\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\nb\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\nl\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\pt-BR\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\pt-PT\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\pt\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\tr-TR\Hangfire.Core.resources.dll
C:\Sources\VS\console_spo_utils\console_spo_utils\bin\Debug\net6.0\zh-TW\Hangfire.Core.resources.dll
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
@@ -48,10 +48,22 @@
"net6.0": {
"targetAlias": "net6.0",
"dependencies": {
"Hangfire.Core": {
"target": "Package",
"version": "[1.7.31, )"
},
"Microsoft.AspNetCore.Components.WebAssembly.Authentication": {
"target": "Package",
"version": "[6.0.8, )"
},
"Microsoft.Extensions.Hosting": {
"target": "Package",
"version": "[6.0.1, )"
},
"Microsoft.Extensions.Hosting.Abstractions": {
"target": "Package",
"version": "[6.0.0, )"
},
"Microsoft.PowerPlatform.Dataverse.Client": {
"target": "Package",
"version": "[1.0.9, )"
@@ -15,6 +15,7 @@
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\6.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.props" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\6.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.aspnetcore.components.webassembly.authentication\6.0.8\buildTransitive\Microsoft.AspNetCore.Components.WebAssembly.Authentication.props" Condition="Exists('$(NuGetPackageRoot)microsoft.aspnetcore.components.webassembly.authentication\6.0.8\buildTransitive\Microsoft.AspNetCore.Components.WebAssembly.Authentication.props')" />
</ImportGroup>
</Project>
@@ -2,6 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)system.text.json\6.0.2\build\System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json\6.0.2\build\System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\6.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\6.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.aspnetcore.components.analyzers\6.0.8\buildTransitive\netstandard2.0\Microsoft.AspNetCore.Components.Analyzers.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.aspnetcore.components.analyzers\6.0.8\buildTransitive\netstandard2.0\Microsoft.AspNetCore.Components.Analyzers.targets')" />
</ImportGroup>
</Project>
File diff suppressed because it is too large Load Diff