Compare commits
10 Commits
3295aea262
...
bb99cef33c
| Author | SHA1 | Date | |
|---|---|---|---|
| bb99cef33c | |||
| 39fa4dedf3 | |||
| f258a284d6 | |||
| 3ab3afe25e | |||
| b840d8a984 | |||
| 551054255a | |||
| bd2cfd8cb5 | |||
| a9eb0e2604 | |||
| 31efec6eb4 | |||
| 924cdd3d4b |
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.8" />
|
||||
<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" />
|
||||
<PackageReference Include="PnP.Core" Version="1.7.0" />
|
||||
<PackageReference Include="PnP.Core.Admin" Version="1.7.0" />
|
||||
<PackageReference Include="PnP.Core.Auth" Version="1.7.0" />
|
||||
<PackageReference Include="SharePointPnPCoreOnline" Version="3.28.2012" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32616.157
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console_spo_utils", "console_spo_utils\console_spo_utils.csproj", "{7F73BBFA-1300-4110-8623-4CBE31011A48}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "library_spo_utils", "library_spo_utils\library_spo_utils.csproj", "{7F73BBFA-1300-4110-8623-4CBE31011A48}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -0,0 +1,187 @@
|
||||
namespace library_spo_utils.Constants;
|
||||
|
||||
internal static class Fields
|
||||
{
|
||||
internal static string[] SiteFields
|
||||
{
|
||||
get
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
"ID Progetto",
|
||||
"PAL_Description",
|
||||
"PAL_Customer",
|
||||
"PAL_DlvReason",
|
||||
"PAL_Status"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] SubSiteProject
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"PAL_Item",
|
||||
"PAL_ItemCode",
|
||||
"PAL_ItemDescription",
|
||||
"PAL_SerialNumber",
|
||||
"PAL_Status"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] SubProject
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"Type",
|
||||
"Name",
|
||||
"_ExtendedDescription",
|
||||
"PAL_Item",
|
||||
"PAL_ItemCode",
|
||||
"PAL_ItemDescription",
|
||||
"PAL_SerialNumber",
|
||||
"Modified",
|
||||
"Editor",
|
||||
"Version",
|
||||
"PAL_Status"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] QuotationView
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"Type",
|
||||
"Name",
|
||||
"PAL_Quotation_Reason",
|
||||
"PAL_ID_Quotation",
|
||||
"PAL_Quotation_Name",
|
||||
"PAL_Description",
|
||||
"PAL_Authors",
|
||||
"PAL_Status"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] NonComplianceView
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"Type",
|
||||
"Name",
|
||||
"PAL_NC_Source",
|
||||
"PAL_NC_Reference",
|
||||
"PAL_NC_Nominative",
|
||||
"PAL_NC_DateOfDetection",
|
||||
"PAL_NC_Project",
|
||||
"PAL_NC_ItemCode",
|
||||
"PAL_NC_PortalUrl",
|
||||
"PAL_Status"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] PurchasingView
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"Tipo",
|
||||
"Nome",
|
||||
"PAL_PO_Supplier",
|
||||
"PAL_Status"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static Dictionary<string, string> SyntheticProjList
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Dictionary<string, string>()
|
||||
{
|
||||
{ SynthticProjTitle[0], "<Eq><FieldRef Name = 'PAL_DlvReason' />"+"<Value Type = 'Choice'>01 VENDITA MACCHINE / IMPIANTI</Value></Eq>" },
|
||||
{ SynthticProjTitle[1], "<Eq><FieldRef Name = 'PAL_DlvReason' /><Value Type = 'Choice'>02 VENDITA RICAMBI</Value></Eq>" },
|
||||
{ SynthticProjTitle[2], "<And><Neq><FieldRef Name = 'PAL_DlvReason' /><Value Type = 'Choice'>01 VENDITA MACCHINE / IMPIANTI</Value></Neq>"+
|
||||
"<Neq><FieldRef Name = 'PAL_DlvReason' /><Value Type = 'Choice'>02 VENDITA RICAMBI</Value></Neq></And>"}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] SynthticProjTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
"Sintetica-caus01",
|
||||
"Sintetica-caus02",
|
||||
"Sintetica-causXX"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal 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", "FALSE", "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_Description", new string[] { "Note", "Descrizione", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
||||
{ "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 } },
|
||||
{ "PAL_Status", new string[] { "Text", "Stato", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static Dictionary<string, string[]> QuotationCustomFields
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Dictionary<string, string[]>()
|
||||
{
|
||||
{ "PAL_Quotation_Reason", new string[] { "Choice", "Causale", "PAL Field", "FALSE", "FALSE", "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_Description", new string[] { "Note", "Descrizione", "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 } },
|
||||
{ "PAL_Status", new string[] { "Text", "Stato", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static Dictionary<string, string[]> NonComplianceCustomFields
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Dictionary<string, string[]>()
|
||||
{
|
||||
{ "PAL_NC_Source", new string[] {"Choice", "Sorgente", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "<CHOICES><CHOICE>Interno</CHOICE><CHOICE>Cliente</CHOICE><CHOICE>Fornitore</CHOICE></CHOICES>" } },
|
||||
{ "PAL_NC_Reference", new string[] { "Text", "Rifermento", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
||||
{ "PAL_NC_Nominative", new string[] { "Text", "Nominativo", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
||||
{ "PAL_NC_DateOfDetection", new string[] { "Text", "Data Rilevazione", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
||||
{ "PAL_NC_Project", new string[] { "Text", "Commessa", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
||||
{ "PAL_NC_ItemCode", new string[] { "Text", "Parte", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
||||
{ "PAL_NC_PortalUrl", new string[] {"URL", "Portal", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
||||
{ "PAL_Status", new string[] { "Text", "Stato", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using System.Collections;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace library_spo_utils.Constants;
|
||||
|
||||
internal static class Folders
|
||||
{
|
||||
internal 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;
|
||||
}
|
||||
internal static Dictionary<string, string> GetProjectQuickMenu(string projName, string subSiteUrl)
|
||||
{
|
||||
var itemQuickMenu = new Dictionary<string, string>
|
||||
{
|
||||
{ $"Commerciale {projName}", $"{subSiteUrl}/Commerciale%20{projName.Replace("-","")}" },
|
||||
{ $"Documenti {projName}", $"{subSiteUrl}/Documenti%20{projName.Replace("-","")}" },
|
||||
{ $"Media {projName}", $"{subSiteUrl}/Media%20{projName.Replace("-","")}" },
|
||||
{ $"SottoCommesse {projName}", $"{subSiteUrl}/SottoCommesse%20{projName.Replace("-", "")}" }
|
||||
};
|
||||
return itemQuickMenu;
|
||||
}
|
||||
internal 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;
|
||||
}
|
||||
|
||||
internal static IEnumerable SubProjectDocSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"09_Documenti_Tecnici",
|
||||
"12_Disegni_Costruttivi",
|
||||
"13_Manuali",
|
||||
"15_Documentazione_Elettrica",
|
||||
"16_Liste_Ricambi"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static IEnumerable OfferDocSet(string rev) =>
|
||||
new string[]
|
||||
{
|
||||
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"
|
||||
};
|
||||
|
||||
|
||||
|
||||
internal static IEnumerable PurchasingOneNoteDir(string year) =>
|
||||
new string[]
|
||||
{
|
||||
$"{year}",
|
||||
$"{year}/Ordini di Acquisto",
|
||||
$"{year}/DDT di Acquisto",
|
||||
$"{year}/Richieste di Acquisto"
|
||||
};
|
||||
|
||||
|
||||
internal static IEnumerable PurchasingOrder
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"Conferma ordine",
|
||||
"Offerte",
|
||||
"Richiesta di Offerta"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace library_spo_utils.Enums
|
||||
{
|
||||
internal enum PalFieldType
|
||||
{
|
||||
Project,
|
||||
Quotation,
|
||||
NonCompliance
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace library_spo_utils.Enums;
|
||||
|
||||
public enum FieldUpdateType
|
||||
{
|
||||
Project,
|
||||
SubProject,
|
||||
Quotation,
|
||||
NonCompliance,
|
||||
PurchasingOrder,
|
||||
PurchasingPackingSlip,
|
||||
PurchasingRequest
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace library_spo_utils.Enums;
|
||||
|
||||
public enum PurchType
|
||||
{
|
||||
Order,
|
||||
PackingSlip,
|
||||
Request
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Fakes.Repositories;
|
||||
|
||||
public class FakeNonComplianceSettingsRepository : INonComplianceRepository
|
||||
{
|
||||
public string DefaultNonComplianceSource(string code)
|
||||
{
|
||||
return "Interno";
|
||||
}
|
||||
|
||||
public string DefaultNonComplianceReference(string code)
|
||||
{
|
||||
return "Italsort";
|
||||
}
|
||||
|
||||
public string DefaultNonComplianceNominative(string code)
|
||||
{
|
||||
return "Mario Issor";
|
||||
}
|
||||
|
||||
public string DefaultNonComplianceDateOfDetection(string code)
|
||||
{
|
||||
return "28-09-2022";
|
||||
}
|
||||
|
||||
public string DefaultNonComplianceProject(string code)
|
||||
{
|
||||
return "CT0001-001";
|
||||
}
|
||||
|
||||
public string DefaultNonComplianceItemCode(string code)
|
||||
{
|
||||
return "M24x3";
|
||||
}
|
||||
|
||||
public FieldUrlValue DefaultNonCompliancePortalUrl(string code)
|
||||
{
|
||||
return new FieldUrlValue
|
||||
{
|
||||
Description = "Vai a Portal",
|
||||
Url = "https://portal.pal.local/"
|
||||
};
|
||||
}
|
||||
|
||||
public string DefaultNonComplianceState(string code)
|
||||
{
|
||||
return "Stato";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
namespace library_spo_utils.Fakes.Repositories;
|
||||
|
||||
public class FakeProjectRepository:IProjectRepository
|
||||
{
|
||||
public string DefaultDlvReason(string projName)
|
||||
{
|
||||
return "02 VENDITA RICAMBI";
|
||||
}
|
||||
|
||||
public string DefaultCostumer(string projName)
|
||||
{
|
||||
return "PAL";
|
||||
}
|
||||
|
||||
public string DefaultState(string projName)
|
||||
{
|
||||
return "Stato";
|
||||
}
|
||||
|
||||
public string DefaultDescription(string projName)
|
||||
{
|
||||
return "Some Description";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
namespace library_spo_utils.Fakes.Repositories;
|
||||
|
||||
public class FakePurchasingOrderSettingsRepository : IPurchasingOrderRepository
|
||||
{
|
||||
public string DefaultPurchasingOrderSupplier(string purchasingOrderName)
|
||||
{
|
||||
return "Fornitore di prova";
|
||||
}
|
||||
|
||||
public string DefaultPurchasingOrderState(string purchasingOrderName)
|
||||
{
|
||||
return "Stato";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
namespace library_spo_utils.Fakes.Repositories;
|
||||
|
||||
public class FakePurchasingPackingSlipSettingsRepository : IPurchasingPackingSlipRepository
|
||||
{
|
||||
public string DefaultPurchasingPackingSlipSupplier(string purchasingPackingSlipName)
|
||||
{
|
||||
return "Fornitore di prova";
|
||||
}
|
||||
|
||||
public string DefaultPurchasingPackingSlipState(string purchasingPackingSlipName)
|
||||
{
|
||||
return "Stato";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
namespace library_spo_utils.Fakes.Repositories;
|
||||
|
||||
public class FakePurchasingRequestSettingsRepository : IPurchasingRequestRepository
|
||||
{
|
||||
public string DefaultPurchasingRequestSupplier(string purchasingRequestName)
|
||||
{
|
||||
return "Fornitore di prova";
|
||||
}
|
||||
|
||||
public string DefaultPurchasingRequestState(string purchasingRequestName)
|
||||
{
|
||||
return "Stato";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
namespace library_spo_utils.Fakes.Repositories;
|
||||
|
||||
public class FakeQuotationSettingRepository:IQuotationRepository
|
||||
{
|
||||
public string DefaultIdQuotation(string quotationName)
|
||||
{
|
||||
return quotationName;
|
||||
}
|
||||
|
||||
public string DefaultQuotationName(string quotationName)
|
||||
{
|
||||
return "Marchiol";
|
||||
}
|
||||
|
||||
public string DefaultQuotationReason(string quotationName)
|
||||
{
|
||||
return "02 VENDITA RICAMBI";
|
||||
}
|
||||
|
||||
public string DefaultAuthors(string quotationName)
|
||||
{
|
||||
return "User";
|
||||
}
|
||||
|
||||
public string DefaultQuotationState(string quotationName)
|
||||
{
|
||||
return "Stato";
|
||||
}
|
||||
|
||||
public string DefaultDescription(string quotationName)
|
||||
{
|
||||
return "Some Description";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
namespace library_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",
|
||||
};
|
||||
}
|
||||
|
||||
public string DefaultDescription(string subProjId)
|
||||
{
|
||||
return "AutomationTest c.s.";
|
||||
}
|
||||
|
||||
public string DefaultItem(string subProjId)
|
||||
{
|
||||
return "Coclea";
|
||||
}
|
||||
|
||||
public string DefaultItemCode(string subProjId)
|
||||
{
|
||||
return "C84M70";
|
||||
}
|
||||
|
||||
public string DefaultItemDescription(string subProjId)
|
||||
{
|
||||
return "7m con le piastrelle";
|
||||
}
|
||||
|
||||
public string DefaultSerialNumber(string subProjId)
|
||||
{
|
||||
return "S/N 000000988948e";
|
||||
}
|
||||
|
||||
public string DefaultState(string subProjId)
|
||||
{
|
||||
return "Stato";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
public interface INonComplianceRepository
|
||||
{
|
||||
public string DefaultNonComplianceSource(string code);
|
||||
public string DefaultNonComplianceReference(string code);
|
||||
public string DefaultNonComplianceNominative(string code);
|
||||
public string DefaultNonComplianceDateOfDetection(string code);
|
||||
public string DefaultNonComplianceProject(string code);
|
||||
public string DefaultNonComplianceItemCode(string code);
|
||||
public FieldUrlValue DefaultNonCompliancePortalUrl(string code);
|
||||
public string DefaultNonComplianceState(string code);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
public interface IProjectRepository
|
||||
{
|
||||
public string DefaultDescription(string projName);
|
||||
public string DefaultDlvReason(string projName);
|
||||
public string DefaultCostumer(string projName);
|
||||
public string DefaultState(string projName);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
public interface IPurchasingOrderRepository
|
||||
{
|
||||
public string DefaultPurchasingOrderSupplier(string purchasingOrderName);
|
||||
public string DefaultPurchasingOrderState(string purchasingOrderName);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
public interface IPurchasingPackingSlipRepository
|
||||
{
|
||||
public string DefaultPurchasingPackingSlipSupplier(string purchasingPackingSlipName);
|
||||
public string DefaultPurchasingPackingSlipState(string purchasingPackingSlipName);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
public interface IPurchasingRequestRepository
|
||||
{
|
||||
public string DefaultPurchasingRequestSupplier(string purchasingRequestName);
|
||||
public string DefaultPurchasingRequestState(string purchasingRequestName);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
namespace library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
public interface IQuotationRepository
|
||||
{
|
||||
public string DefaultIdQuotation(string quotationName);
|
||||
public string DefaultQuotationName(string quotationName);
|
||||
public string DefaultDescription(string quotationName);
|
||||
public string DefaultQuotationReason(string quotationName);
|
||||
public string DefaultAuthors(string quotationName);
|
||||
public string DefaultQuotationState(string quotationName);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace library_spo_utils.Interfaces.Repositories;
|
||||
|
||||
public interface ISubProjectRepository
|
||||
{
|
||||
public List<string> GetFromProject(string projName);
|
||||
public string DefaultDescription(string subProjId);
|
||||
public string DefaultItem(string subProjId);
|
||||
public string DefaultItemCode(string subProjId);
|
||||
public string DefaultItemDescription(string subProjId);
|
||||
public string DefaultSerialNumber(string subProjId);
|
||||
public string DefaultState(string subProjId);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using library_spo_utils.Enums;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IFieldEntryDataUpdate
|
||||
{
|
||||
public void FieldUpdate(ClientContext ctx, string listName, string element, FieldUpdateType type);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface INonComplianceBuildService
|
||||
{
|
||||
public void CreateIfNotExists(string nonComplianceName);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface INonComplianceDocLibraryService
|
||||
{
|
||||
public void Create(string libName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface INonComplianceDocSetService
|
||||
{
|
||||
public void Create(string nonComplianceName, string docLibraryName, string tenantName, ClientContext ctx);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using library_spo_utils.Enums;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IOneNoteService
|
||||
{
|
||||
public bool CreateFolderInsideProject(string projName, ClientContext ctx);
|
||||
public bool CreateFolderInsideQuotation(string quotationName, ClientContext ctx);
|
||||
public bool CreateFolderInsideNonCompliance(string quotationName, ClientContext ctx);
|
||||
public bool CreateFolderInsidePurchasing(string purchasingName, ClientContext ctx, PurchType type);
|
||||
public void EnableFeature(ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IProjectDocLibraryService
|
||||
{
|
||||
void Create(string projName, ClientContext subSiteContext);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IProjectQuickMenuService
|
||||
{
|
||||
void CreateForProject(string projNames, ClientContext subSiteContext);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IProjectService
|
||||
{
|
||||
public void BuildWebParts(string projName);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IProjectYearService
|
||||
{
|
||||
public void CreateList(string projName, string listTitle, ClientContext ctx);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingOrderBuildService
|
||||
{
|
||||
public void CreateIfNotExists(string purchasingOrder);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingOrderDocLibraryService
|
||||
{
|
||||
public void Create(string libName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingOrderDocSetService
|
||||
{
|
||||
public void Create(string purchasingOrderName, string docLibraryName, string tenantName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingPackingSlipBuildService
|
||||
{
|
||||
public void CreateIfNotExists(string purchasingPackingSlipName);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingPackingSlipDocLibraryService
|
||||
{
|
||||
public void Create(string libName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingPackingSlipDocSetService
|
||||
{
|
||||
public void Create(string purchasingPackingSlipName, string docLibraryName, string tenantName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingRequestBuildService
|
||||
{
|
||||
public void CreateIfNotExists(string purchasingRequestName);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingRequestDocLibraryService
|
||||
{
|
||||
public void Create(string libName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface IPurchasingRequestDocSetService
|
||||
{
|
||||
public void Create(string purchasingRequestName, string docLibraryName, string tenantName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IQuotationBuildService
|
||||
{
|
||||
void CreateIfNotExists(string quotationName);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IQuotationDocLibraryService
|
||||
{
|
||||
public void Create(string libName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IQuotationDocSetService
|
||||
{
|
||||
public void Create(string quotationName, string docLibraryName, string tenantName, ClientContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IRightsService
|
||||
{
|
||||
void DomainGroupRights(ClientContext ctx, string tenantName, string docLibName = "");
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface ISharePointAuthenticationManager
|
||||
{
|
||||
ClientContext GetContext(Uri web);
|
||||
Task<string> EnsureAccessTokenAsync(Uri resourceUri, string userPrincipalName, string userPassword);
|
||||
void Dispose();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using library_spo_utils.Enums;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface ISharePointCustomOperation
|
||||
{
|
||||
bool SiteExist(ClientContext ctx);
|
||||
bool ListExist(ClientContext ctx, string listTitle);
|
||||
bool FolderExist(ClientContext ctx, string path);
|
||||
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,11 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
public interface ISharePointStructureBuilder
|
||||
{
|
||||
public bool BuildProject(string projName);
|
||||
public bool BuildQuotation(string quotationName);
|
||||
public bool BuildNonCompliance(string nonComplianceName);
|
||||
public bool BuildPurchasingOrder(string purchasingOrderName);
|
||||
public bool BuildPurchasingPackingSlip(string purchasingPackingSlipName);
|
||||
public bool BuildPurchasingRequest(string purchasingRequestName);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using PnP.Core.Model.SharePoint;
|
||||
using System.Security;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface ISiteOptions
|
||||
{
|
||||
public string TokenEndpoint { get; }
|
||||
public string DefaultAadAppId { get; }
|
||||
public Uri GetProjectYearSite(string code);
|
||||
public string GetYear(string code);
|
||||
public bool IsValidDate(string code);
|
||||
public string GetProjYearTenant(string code);
|
||||
public string GetUser();
|
||||
public SecureString GetPassword();
|
||||
public string GetProjListTitle(string code);
|
||||
public Uri GetSubProjSite(string projName);
|
||||
string GetQuotationTenant();
|
||||
Uri GetQuotationSite();
|
||||
string GetSubProjList(string projName);
|
||||
public string GetQuotationLibrary(string code);
|
||||
public Uri GetProjectSite();
|
||||
public string GetNonComplianceTenant();
|
||||
public string GetNonComplianceLibrary(string code);
|
||||
public Uri GetNonComplianceSite();
|
||||
public Uri GetPurchasingSite();
|
||||
public string GetPurchasingOrderTenat();
|
||||
public string GetPurchasingOrderLibrary(string code);
|
||||
public Uri GetPurchasingOrderSite();
|
||||
public string GetPurchasingPackingSlipTenat();
|
||||
public string GetPurchasingPackingSlipLibrary(string code);
|
||||
public Uri GetPurchasingPackingSlipSite();
|
||||
public string GetPurchasingRequestTenat();
|
||||
public string GetPurchasingRequestLibrary(string code);
|
||||
public Uri GetPurchasingRequestSite();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface ISiteService
|
||||
{
|
||||
public bool CreateProjectSiteIfNotExists(string projName);
|
||||
public bool CreateSubSiteIfNotExists(string projName);
|
||||
public bool CreateQuotationSiteIfNotExists(string quotationName);
|
||||
public bool CreateNonComplianceSiteIfNotExists(string nonComplianceName);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface ISubProjectBuilderService
|
||||
{
|
||||
bool SubProjectDocSet(string projName, List<string> listOfSubProjIds);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface ISubSiteService
|
||||
{
|
||||
bool Create(string projName, ClientContext siteContext);
|
||||
void AddColumnsToListView(string projName, ClientContext subSiteContext);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface ITenantService
|
||||
{
|
||||
public void CreateForProject(string projName);
|
||||
public void CreateForQuotation();
|
||||
public void CreateForNonCompliance();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.WebParts;
|
||||
|
||||
namespace library_spo_utils.Interfaces.Services;
|
||||
|
||||
internal interface IWebpartService
|
||||
{
|
||||
public void AddWebPart(Web web, LimitedWebPartManager mgr, string xmlSchema, string listName, string zoneName,int zoneId);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace library_spo_utils.Model
|
||||
{
|
||||
internal 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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace library_spo_utils.Model
|
||||
{
|
||||
internal 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; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace library_spo_utils.Model
|
||||
{
|
||||
internal class TokenWaitInfo
|
||||
{
|
||||
internal RegisteredWaitHandle Handle = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using library_spo_utils.Fakes.Repositories;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using library_spo_utils.Services;
|
||||
using library_spo_utils.Workers;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace library_spo_utils
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var host = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddSharePointExtensions();
|
||||
services.AddTransient<IProjectRepository, FakeProjectRepository>();
|
||||
services.AddTransient<ISubProjectRepository, FakeSubProjectRepository>();
|
||||
services.AddTransient<IQuotationRepository, FakeQuotationSettingRepository>();
|
||||
services.AddTransient<INonComplianceRepository, FakeNonComplianceSettingsRepository>();
|
||||
services.AddTransient<IPurchasingOrderRepository, FakePurchasingOrderSettingsRepository>();
|
||||
services.AddTransient<IPurchasingPackingSlipRepository, FakePurchasingPackingSlipSettingsRepository>();
|
||||
services.AddTransient<IPurchasingRequestRepository, FakePurchasingRequestSettingsRepository>();
|
||||
services.AddHostedService<MainWorker>();
|
||||
|
||||
})
|
||||
.Build();
|
||||
|
||||
await host.RunAsync();
|
||||
}
|
||||
|
||||
public static IServiceCollection AddSharePointExtensions(this IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<IOneNoteService, OneNoteService>();
|
||||
services.AddTransient<IProjectDocLibraryService, ProjectDocLibraryService>();
|
||||
services.AddTransient<IProjectQuickMenuService, ProjectQuickMenuService>();
|
||||
services.AddTransient<ISharePointStructureBuilder, SharePointStructureBuilderService>();
|
||||
services.AddTransient<IProjectYearService, ProjectYearService>();
|
||||
services.AddTransient<ISiteService, SiteService>();
|
||||
services.AddSingleton<ISharePointAuthenticationManager, SharePointAuthenticationManager>();
|
||||
services.AddSingleton<ISharePointCustomOperation, SharePointCustomOperation>();
|
||||
services.AddSingleton<ISiteOptions, SiteOptions>();
|
||||
services.AddTransient<IRightsService, RightsService>();
|
||||
services.AddTransient<ISubSiteService, SubSiteService>();
|
||||
services.AddTransient<ITenantService, TenantService>();
|
||||
services.AddTransient<ISubProjectBuilderService, SubProjectBuilderService>();
|
||||
services.AddTransient<IQuotationBuildService, QuotationBuildService>();
|
||||
services.AddTransient<IQuotationDocLibraryService, QuotationDocLibraryService>();
|
||||
services.AddTransient<IQuotationDocSetService, QuotationDocSetService>();
|
||||
services.AddTransient<INonComplianceBuildService, NonComplianceBuildService>();
|
||||
services.AddTransient<INonComplianceDocLibraryService, NonComplianceDocLibraryService>();
|
||||
services.AddTransient<INonComplianceDocSetService, NonComplianceDocSetService>();
|
||||
services.AddTransient<IPurchasingOrderBuildService, PurchasingOrderBuildService>();
|
||||
services.AddTransient<IPurchasingOrderDocLibraryService, PurchasingOrderDocLibraryService>();
|
||||
services.AddTransient<IPurchasingOrderDocSetService, PurchasingOrderDocSetService>();
|
||||
services.AddTransient<IPurchasingPackingSlipBuildService, PurchasingPackingSlipBuildService>();
|
||||
services.AddTransient<IPurchasingPackingSlipDocLibraryService, PurchasingPackingSlipDocLibraryService>();
|
||||
services.AddTransient<IPurchasingPackingSlipDocSetService, PurchasingPackingSlipDocSetService>();
|
||||
services.AddTransient<IPurchasingRequestBuildService, PurchasingRequestBuildService>();
|
||||
services.AddTransient<IPurchasingRequestDocLibraryService, PurchasingRequestDocLibraryService>();
|
||||
services.AddTransient<IPurchasingRequestDocSetService, PurchasingRequestDocSetService>();
|
||||
services.AddTransient<IFieldEntryDataUpdate, FieldEntryDataUpdate>();
|
||||
services.AddTransient<IWebpartService, WebpartService>();
|
||||
services.AddTransient<IProjectService, ProjectService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Web;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using library_spo_utils.Model;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services
|
||||
{
|
||||
internal 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
using System;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using AngleSharp.Dom;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using PnP.Framework.Extensions;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class FieldEntryDataUpdate : IFieldEntryDataUpdate
|
||||
{
|
||||
private readonly ISiteOptions _siteOptions;
|
||||
private readonly IProjectRepository _projectRepository;
|
||||
private readonly ISubProjectRepository _subProjectRepository;
|
||||
private readonly IQuotationRepository _quotationRepository;
|
||||
private readonly INonComplianceRepository _nonComplianceRepository;
|
||||
private readonly IPurchasingOrderRepository _purchasingOrderRepository;
|
||||
private readonly IPurchasingPackingSlipRepository _purchasingPackingSlipRepository;
|
||||
private readonly IPurchasingRequestRepository _purchasingRequestRepository;
|
||||
|
||||
public FieldEntryDataUpdate(
|
||||
ISiteOptions siteOptions,
|
||||
IProjectRepository projectRepository,
|
||||
ISubProjectRepository subProjectRepository,
|
||||
IQuotationRepository quotationRepository,
|
||||
INonComplianceRepository nonComplianceRepository,
|
||||
IPurchasingOrderRepository purchasingOrderRepository,
|
||||
IPurchasingPackingSlipRepository purchasingPackingSlipRepository,
|
||||
IPurchasingRequestRepository purchasingRequestRepository
|
||||
)
|
||||
{
|
||||
_siteOptions = siteOptions;
|
||||
_projectRepository = projectRepository;
|
||||
_subProjectRepository = subProjectRepository;
|
||||
_quotationRepository = quotationRepository;
|
||||
_nonComplianceRepository = nonComplianceRepository;
|
||||
_purchasingOrderRepository = purchasingOrderRepository;
|
||||
_purchasingPackingSlipRepository = purchasingPackingSlipRepository;
|
||||
_purchasingRequestRepository = purchasingRequestRepository;
|
||||
}
|
||||
|
||||
public void FieldUpdate(ClientContext ctx, string listName, string element, FieldUpdateType type)
|
||||
{
|
||||
List oList = ctx.Web.Lists.GetByTitle(listName);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case FieldUpdateType.Project:
|
||||
Project(ctx, oList, element);
|
||||
break;
|
||||
|
||||
case FieldUpdateType.SubProject:
|
||||
SubProject(ctx, oList, element);
|
||||
break;
|
||||
|
||||
case FieldUpdateType.Quotation:
|
||||
Quotation(ctx, oList, element);
|
||||
break;
|
||||
|
||||
case FieldUpdateType.NonCompliance:
|
||||
NonCompliance(ctx, oList, element);
|
||||
break;
|
||||
|
||||
case FieldUpdateType.PurchasingOrder:
|
||||
PurchasingOrder(ctx, oList, element);
|
||||
break;
|
||||
|
||||
case FieldUpdateType.PurchasingPackingSlip:
|
||||
PurchasingPackingSlip(ctx, oList, element);
|
||||
break;
|
||||
|
||||
case FieldUpdateType.PurchasingRequest:
|
||||
PurchasingRequest(ctx, oList, element);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Project(ClientContext ctx, List oList, string element)
|
||||
{
|
||||
var url = $"/sites/{_siteOptions.GetProjYearTenant(element).Replace(" ", string.Empty)}/{element}";
|
||||
|
||||
CamlQuery cQuery = new CamlQuery()
|
||||
{
|
||||
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='PAL_ID_Project'/><Value Type='URL'>{url}</Value></Eq></Where></Query></View>"
|
||||
};
|
||||
|
||||
var collection = oList.GetItems(cQuery);
|
||||
|
||||
ctx.Load(collection);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
foreach (var oListItem in collection)
|
||||
{
|
||||
oListItem["PAL_Description"] = _projectRepository.DefaultDescription(element);
|
||||
oListItem["PAL_Customer"] = _projectRepository.DefaultCostumer(element);
|
||||
oListItem["PAL_DlvReason"] = _projectRepository.DefaultDlvReason(element);
|
||||
oListItem["PAL_Status"] = _projectRepository.DefaultState(element);
|
||||
oListItem.Update();
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
|
||||
private void SubProject(ClientContext ctx, List oList, string element)
|
||||
{
|
||||
CamlQuery cQuery = new CamlQuery()
|
||||
{
|
||||
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
|
||||
};
|
||||
|
||||
var collection = oList.GetItems(cQuery);
|
||||
|
||||
ctx.Load(collection);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
foreach (var oListItem in collection)
|
||||
{
|
||||
oListItem["_ExtendedDescription"] = _subProjectRepository.DefaultDescription(element);
|
||||
oListItem["PAL_Item"] = _subProjectRepository.DefaultItem(element);
|
||||
oListItem["PAL_ItemCode"] = _subProjectRepository.DefaultItemCode(element);
|
||||
oListItem["PAL_ItemDescription"] = _subProjectRepository.DefaultItemDescription(element);
|
||||
oListItem["PAL_SerialNumber"] = _subProjectRepository.DefaultSerialNumber(element);
|
||||
oListItem["PAL_Status"] = _subProjectRepository.DefaultState(element);
|
||||
oListItem.Update();
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
|
||||
private void Quotation(ClientContext ctx, List oList, string element)
|
||||
{
|
||||
CamlQuery cQuery = new CamlQuery()
|
||||
{
|
||||
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
|
||||
};
|
||||
|
||||
var collection = oList.GetItems(cQuery);
|
||||
|
||||
ctx.Load(collection);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
foreach (var oListItem in collection)
|
||||
{
|
||||
oListItem["PAL_ID_Quotation"] = _quotationRepository.DefaultIdQuotation(element);
|
||||
oListItem["PAL_Quotation_Name"] = _quotationRepository.DefaultQuotationName(element);
|
||||
oListItem["PAL_Description"] = _quotationRepository.DefaultDescription(element);
|
||||
oListItem["PAL_Quotation_Reason"] = _quotationRepository.DefaultQuotationReason(element);
|
||||
oListItem["PAL_Authors"] = _quotationRepository.DefaultAuthors(element);
|
||||
oListItem["PAL_Status"] = _quotationRepository.DefaultQuotationState(element);
|
||||
oListItem.Update();
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
|
||||
private void NonCompliance(ClientContext ctx, List oList, string element)
|
||||
{
|
||||
CamlQuery cQuery = new CamlQuery()
|
||||
{
|
||||
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
|
||||
};
|
||||
|
||||
var collection = oList.GetItems(cQuery);
|
||||
|
||||
ctx.Load(collection);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
foreach (var oListItem in collection)
|
||||
{
|
||||
oListItem["PAL_NC_Source"] = _nonComplianceRepository.DefaultNonComplianceSource(element);
|
||||
oListItem["PAL_NC_Reference"] = _nonComplianceRepository.DefaultNonComplianceReference(element);
|
||||
oListItem["PAL_NC_Nominative"] = _nonComplianceRepository.DefaultNonComplianceNominative(element);
|
||||
oListItem["PAL_NC_DateOfDetection"] = _nonComplianceRepository.DefaultNonComplianceDateOfDetection(element);
|
||||
oListItem["PAL_NC_Project"] = _nonComplianceRepository.DefaultNonComplianceProject(element);
|
||||
oListItem["PAL_NC_ItemCode"] = _nonComplianceRepository.DefaultNonComplianceItemCode(element);
|
||||
oListItem["PAL_NC_PortalUrl"] = _nonComplianceRepository.DefaultNonCompliancePortalUrl(element);
|
||||
oListItem["PAL_Status"] = _nonComplianceRepository.DefaultNonComplianceState(element);
|
||||
oListItem.Update();
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
|
||||
private void PurchasingOrder(ClientContext ctx, List oList, string element)
|
||||
{
|
||||
|
||||
CamlQuery cQuery = new CamlQuery()
|
||||
{
|
||||
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
|
||||
};
|
||||
|
||||
var collection = oList.GetItems(cQuery);
|
||||
|
||||
ctx.Load(collection);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
foreach (var oListItem in collection)
|
||||
{
|
||||
oListItem["PAL_PO_Supplier"] = _purchasingOrderRepository.DefaultPurchasingOrderSupplier(element);
|
||||
oListItem["PAL_Status"] = _purchasingOrderRepository.DefaultPurchasingOrderState(element);
|
||||
oListItem.Update();
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
|
||||
private void PurchasingPackingSlip(ClientContext ctx, List oList, string element)
|
||||
{
|
||||
|
||||
CamlQuery cQuery = new CamlQuery()
|
||||
{
|
||||
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
|
||||
};
|
||||
|
||||
var collection = oList.GetItems(cQuery);
|
||||
|
||||
ctx.Load(collection);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
foreach (var oListItem in collection)
|
||||
{
|
||||
oListItem["PAL_PO_Supplier"] = _purchasingPackingSlipRepository.DefaultPurchasingPackingSlipSupplier(element);
|
||||
oListItem["PAL_Status"] = _purchasingPackingSlipRepository.DefaultPurchasingPackingSlipState(element);
|
||||
oListItem.Update();
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
|
||||
private void PurchasingRequest(ClientContext ctx, List oList, string element)
|
||||
{
|
||||
|
||||
CamlQuery cQuery = new CamlQuery()
|
||||
{
|
||||
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
|
||||
};
|
||||
|
||||
var collection = oList.GetItems(cQuery);
|
||||
|
||||
ctx.Load(collection);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
foreach (var oListItem in collection)
|
||||
{
|
||||
oListItem["PAL_PO_Supplier"] = _purchasingRequestRepository.DefaultPurchasingRequestSupplier(element);
|
||||
oListItem["PAL_Status"] = _purchasingRequestRepository.DefaultPurchasingRequestState(element);
|
||||
oListItem.Update();
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class NonComplianceBuildService : INonComplianceBuildService
|
||||
{
|
||||
private readonly ISiteOptions siteOptions;
|
||||
private readonly ISharePointAuthenticationManager sharePointAuthenticationManager;
|
||||
private readonly ISharePointCustomOperation spc;
|
||||
private readonly ITenantService tenantService;
|
||||
private readonly INonComplianceDocLibraryService nonComplianceDocLibraryService;
|
||||
private readonly INonComplianceDocSetService nonComplianceDocSetService;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ILogger<NonComplianceBuildService> logger;
|
||||
|
||||
public NonComplianceBuildService(
|
||||
ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ISharePointCustomOperation spc,
|
||||
ITenantService tenantService,
|
||||
INonComplianceDocLibraryService nonComplianceDocLibraryService,
|
||||
INonComplianceDocSetService nonComplianceDocSetService,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ILogger<NonComplianceBuildService> logger)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
this.sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
this.spc = spc;
|
||||
this.tenantService = tenantService;
|
||||
this.nonComplianceDocLibraryService = nonComplianceDocLibraryService;
|
||||
this.nonComplianceDocSetService = nonComplianceDocSetService;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public void CreateIfNotExists(string nonComplianceName)
|
||||
{
|
||||
var site = siteOptions.GetNonComplianceSite();
|
||||
var ctx = sharePointAuthenticationManager.GetContext(site);
|
||||
var list = siteOptions.GetNonComplianceLibrary(nonComplianceName);
|
||||
var tenant = siteOptions.GetNonComplianceTenant();
|
||||
|
||||
if (!spc.SiteExist(ctx))
|
||||
{
|
||||
tenantService.CreateForNonCompliance();
|
||||
}
|
||||
|
||||
if (!spc.ListExist(ctx, list))
|
||||
{
|
||||
nonComplianceDocLibraryService.Create(list, ctx);
|
||||
}
|
||||
|
||||
if (!spc.FolderExistsInsideList(ctx, list, nonComplianceName))
|
||||
{
|
||||
nonComplianceDocSetService.Create(nonComplianceName, list, tenant, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation($"Quotation with {nonComplianceName} already exist");
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, list, nonComplianceName, FieldUpdateType.NonCompliance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class NonComplianceDocLibraryService : INonComplianceDocLibraryService
|
||||
{
|
||||
private readonly ILogger<NonComplianceDocLibraryService> logger;
|
||||
|
||||
public NonComplianceDocLibraryService(ILogger<NonComplianceDocLibraryService> 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 = { "Sorgente", "Rifermento", "Nominativo", "Data Rilevazione", "Commessa", "Parte", "Portal", "Stato" };
|
||||
|
||||
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 = Fields.NonComplianceView;
|
||||
|
||||
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").Replace("à", "")}";
|
||||
newNavNode.AsLastNode = true;
|
||||
spNavNodeColl.Add(newNavNode);
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> Il menu rapido è stato aggiornato, il collegamento a {libName} è ora disponibile.");
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "NonComplianceDocLibraryService");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.DocumentSet;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class NonComplianceDocSetService : INonComplianceDocSetService
|
||||
{
|
||||
private readonly ISharePointCustomOperation cpt;
|
||||
private readonly IOneNoteService oneNoteService;
|
||||
private readonly INonComplianceRepository nonComplianceRepository;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
|
||||
public NonComplianceDocSetService(
|
||||
ISharePointCustomOperation cpt,
|
||||
IOneNoteService oneNoteService,
|
||||
INonComplianceRepository nonComplianceRepository,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate)
|
||||
{
|
||||
this.cpt = cpt;
|
||||
this.oneNoteService = oneNoteService;
|
||||
this.nonComplianceRepository = nonComplianceRepository;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
}
|
||||
|
||||
public void Create(string nonComplianceName, string docLibraryName, string tenantName, ClientContext ctx)
|
||||
{
|
||||
#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 {nonComplianceName}.");
|
||||
|
||||
#region DocSet Field Entry
|
||||
|
||||
DocumentSet.Create(ctx, list.RootFolder, nonComplianceName, contentType.Id);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> DocumentSet {nonComplianceName} creata.");
|
||||
|
||||
//var dsItem = list.RootFolder.Folders.GetByUrl(nonComplianceName).ListItemAllFields;
|
||||
|
||||
//dsItem["PAL_NC_Source"] = nonComplianceRepository.DefaultNonComplianceSource(nonComplianceName);
|
||||
//dsItem["PAL_NC_Reference"] = nonComplianceRepository.DefaultNonComplianceReference(nonComplianceName);
|
||||
//dsItem["PAL_NC_Nominative"] = nonComplianceRepository.DefaultNonComplianceNominative(nonComplianceName);
|
||||
//dsItem["PAL_NC_DateOfDetection"] = nonComplianceRepository.DefaultNonComplianceDateOfDetection(nonComplianceName);
|
||||
//dsItem["PAL_NC_Project"] = nonComplianceRepository.DefaultNonComplianceProject(nonComplianceName);
|
||||
//dsItem["PAL_NC_ItemCode"] = nonComplianceRepository.DefaultNonComplianceItemCode(nonComplianceName);
|
||||
//dsItem["PAL_NC_PortalUrl"] = nonComplianceRepository.DefaultNonCompliancePortalUrl(nonComplianceName);
|
||||
//dsItem["PAL_Status"] = nonComplianceRepository.DefaultNonComplianceState(nonComplianceName);
|
||||
|
||||
//dsItem.Update();
|
||||
//ctx.ExecuteQuery();
|
||||
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, docLibraryName, nonComplianceName, FieldUpdateType.NonCompliance);
|
||||
|
||||
Console.WriteLine($"> Field value update.");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Folder
|
||||
|
||||
oneNoteService.CreateFolderInsideNonCompliance(nonComplianceName, ctx);
|
||||
|
||||
Console.WriteLine($"Le sotto cartelle sono state create con successo in {nonComplianceName}");
|
||||
|
||||
#endregion
|
||||
|
||||
Console.WriteLine($"> {nonComplianceName} creato con successo in Offerte/{docLibraryName}.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
using System.Net;
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class OneNoteService : IOneNoteService
|
||||
{
|
||||
private readonly ILogger<OneNoteService> logger;
|
||||
private readonly ISiteOptions siteOptions;
|
||||
private readonly ISharePointCustomOperation spc;
|
||||
|
||||
public OneNoteService(
|
||||
ILogger<OneNoteService> logger,
|
||||
ISiteOptions siteOptions,
|
||||
ISharePointCustomOperation spc)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.siteOptions = siteOptions;
|
||||
this.spc = spc;
|
||||
}
|
||||
|
||||
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.GetProjYearTenant(projName)} 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 year = siteOptions.GetYear(quotationName);
|
||||
|
||||
var list = ctx.Web.Lists.EnsureSiteAssetsLibrary();
|
||||
ctx.Load(list, l => l.RootFolder);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
if (!spc.FolderExist(ctx, $"SiteAssets/{siteOptions.GetQuotationTenant()} Notebook/{year}"))
|
||||
{
|
||||
var rYearPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{year}");
|
||||
list.RootFolder.AddSubFolderUsingPath(rYearPath);
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
|
||||
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{year}/{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 bool CreateFolderInsideNonCompliance(string nonComplianceName, ClientContext ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
logger.LogInformation($"> Inizializzata la fase di creazione della sezione {nonComplianceName} in OneNote.");
|
||||
|
||||
var year = siteOptions.GetYear(nonComplianceName);
|
||||
|
||||
var list = ctx.Web.Lists.EnsureSiteAssetsLibrary();
|
||||
ctx.Load(list, l => l.RootFolder);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
if (!spc.FolderExist(ctx, $"SiteAssets/{siteOptions.GetNonComplianceTenant()} Notebook/{year}"))
|
||||
{
|
||||
var rYearPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetNonComplianceTenant()} Notebook/{year}");
|
||||
list.RootFolder.AddSubFolderUsingPath(rYearPath);
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
|
||||
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetNonComplianceTenant()} Notebook/{year}/{nonComplianceName}");
|
||||
list.RootFolder.AddSubFolderUsingPath(rPath);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
logger.LogInformation($"> Completata la fase di creazione della sezione {nonComplianceName} in OneNote.");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "OnenoteSPFeature");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CreateFolderInsidePurchasing(string purchasingName, ClientContext ctx, PurchType type)
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.LogInformation($"> Inizializzata la fase di creazione della sezione {purchasingName} in OneNote.");
|
||||
|
||||
var purchasingOneNote = "Acquisti Notebook";
|
||||
var year = siteOptions.GetYear(purchasingName);
|
||||
|
||||
|
||||
var list = ctx.Web.Lists.EnsureSiteAssetsLibrary();
|
||||
ctx.Load(list, l => l.RootFolder);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
if (!spc.FolderExist(ctx, $"SiteAssets/{purchasingOneNote}/{year}"))
|
||||
{
|
||||
foreach (var dir in Folders.PurchasingOneNoteDir(year))
|
||||
{
|
||||
var rDirPath = ResourcePath.FromDecodedUrl($"{purchasingOneNote}/{dir}");
|
||||
list.RootFolder.AddSubFolderUsingPath(rDirPath);
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case PurchType.Order:
|
||||
var oPath = ResourcePath.FromDecodedUrl($"{purchasingOneNote}/{year}/Ordini di Acquisto/{purchasingName}");
|
||||
list.RootFolder.AddSubFolderUsingPath(oPath);
|
||||
ctx.ExecuteQuery();
|
||||
break;
|
||||
|
||||
case PurchType.PackingSlip:
|
||||
var psPath = ResourcePath.FromDecodedUrl($"{purchasingOneNote}/{year}/DDT di Acquisto/{purchasingName}");
|
||||
list.RootFolder.AddSubFolderUsingPath(psPath);
|
||||
ctx.ExecuteQuery();
|
||||
break;
|
||||
|
||||
case PurchType.Request:
|
||||
var rPath = ResourcePath.FromDecodedUrl($"{purchasingOneNote}/{year}/Richieste di Acquisto/{purchasingName}");
|
||||
list.RootFolder.AddSubFolderUsingPath(rPath);
|
||||
ctx.ExecuteQuery();
|
||||
break;
|
||||
}
|
||||
|
||||
logger.LogInformation($"> Completata la fase di creazione della sezione {purchasingName} 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 (!spc.SiteFeaturesExist(ctx, featureName))
|
||||
{
|
||||
ctx.Web.ActivateFeature(featureId);
|
||||
ctx.ExecuteQuery();
|
||||
logger.LogInformation($"> La Feature {featureName} è ora attiva!");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal 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)
|
||||
{
|
||||
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,87 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal 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
|
||||
{
|
||||
ClearQuickMenu(ctx);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
var projNameWithoutDash = projName.Replace("-", "");
|
||||
|
||||
ctx.Web.RootFolder.WelcomePage = $"SottoCommesse%20{projNameWithoutDash}/Forms/SottoCommesse%20{projNameWithoutDash}.aspx";
|
||||
|
||||
ctx.Web.RootFolder.Update();
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "CreateForProject");
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearQuickMenu(ClientContext ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
NavigationNodeCollection navBar = ctx.Web.Navigation.QuickLaunch;
|
||||
ctx.Load(navBar);
|
||||
ctx.ExecuteQueryRetry();
|
||||
|
||||
int[] element = new[] { 1, 1, 1 };
|
||||
|
||||
foreach (var e in element)
|
||||
{
|
||||
navBar[e].DeleteObject();
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "ClearQuickMenu");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.WebParts;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class ProjectService : IProjectService
|
||||
{
|
||||
private readonly ISiteOptions siteOptions;
|
||||
private readonly ISharePointAuthenticationManager sharePointAuthenticationManager;
|
||||
private readonly IWebpartService webpartService;
|
||||
private readonly ILogger<ProjectService> logger;
|
||||
|
||||
public ProjectService(ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
IWebpartService webpartService,
|
||||
ILogger<ProjectService> logger)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
this.sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
this.webpartService = webpartService;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public void BuildWebParts(string projName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string wpName = siteOptions.GetProjYearTenant(projName);
|
||||
|
||||
var listView = GetListsId(projName, siteOptions.GetProjListTitle(projName), Fields.SynthticProjTitle);
|
||||
|
||||
var ctx = sharePointAuthenticationManager.GetContext(siteOptions.GetProjectSite());
|
||||
Web web = ctx.Web;
|
||||
var file = web.GetFileByServerRelativeUrl("/sites/Commesse/SitePages/Home.aspx");
|
||||
ctx.Load(web);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
LimitedWebPartManager mgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
|
||||
|
||||
string url = siteOptions.GetProjectYearSite(projName) + "/Lists/" +
|
||||
siteOptions.GetProjListTitle(projName).Replace(" ", "%20") +
|
||||
"/" + siteOptions.GetProjListTitle(projName).Replace(" ", "%20") + ".aspx?viewid=";
|
||||
|
||||
string htmlSchema = $"<div><h1 style=\"font-weight: bold; font-size: 18pt; clear: both;\">{siteOptions.GetProjYearTenant(projName)}</h1></div>" +
|
||||
$"<div><p><a style=\"color: green\" href=\"{url}{listView[Fields.SynthticProjTitle[0]]}\">Progetti Macchina</a><br>Solo i progetti di vendita Macchine/Impianti</p></div>" +
|
||||
$"<div><p><a style=\"color: green\" href=\"{url}{listView[Fields.SynthticProjTitle[1]]}\">Progetti Ricambi</a><br>Solo i progetti di vendita Ricambi</p></div>" +
|
||||
$"<div><p><a style=\"color: green\" href=\"{url}{listView[Fields.SynthticProjTitle[2]]}\">Altri Progetti</a><br>Tutti gli altri progetti che non siano di vendita Macchine/Impianti o Ricambi</p></div>";
|
||||
|
||||
string xmlSchema = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<WebPart xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
|
||||
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" +
|
||||
" xmlns=\"http://schemas.microsoft.com/WebPart/v2\">" +
|
||||
$"<Title>{siteOptions.GetProjYearTenant(projName)}</Title><FrameType>None</FrameType>" +
|
||||
"<Assembly>Microsoft.SharePoint, Version=13.0.0.0, Culture=neutral, " +
|
||||
"PublicKeyToken=94de0004b6e3fcc5</Assembly>" +
|
||||
"<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>" +
|
||||
"<ContentLink xmlns=\"http://schemas.microsoft.com/WebPart/v2/ContentEditor\" />" +
|
||||
"<Content xmlns=\"http://schemas.microsoft.com/WebPart/v2/ContentEditor\">" +
|
||||
$"<![CDATA[{htmlSchema}]]></Content>" +
|
||||
"<PartStorage xmlns=\"http://schemas.microsoft.com/WebPart/v2/ContentEditor\" /></WebPart>";
|
||||
|
||||
webpartService.AddWebPart(web, mgr, xmlSchema, wpName, "Body", 0);
|
||||
|
||||
|
||||
var qm = new NavigationNodeCreationInformation()
|
||||
{
|
||||
Title = siteOptions.GetProjYearTenant(projName),
|
||||
Url = siteOptions.GetProjectYearSite(projName).ToString(),
|
||||
AsLastNode = true
|
||||
};
|
||||
|
||||
web.Navigation.QuickLaunch.Add(qm);
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "WebPart Build");
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetListsId(string projName, string listTitle, string[] listViewTitle)
|
||||
{
|
||||
Dictionary<string, string> listViewId = new Dictionary<string, string>();
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var lViewTitle in listViewTitle)
|
||||
{
|
||||
var ctx = sharePointAuthenticationManager.GetContext(siteOptions.GetProjectYearSite(projName));
|
||||
|
||||
var list = ctx.Web.Lists.GetByTitle(listTitle);
|
||||
ctx.Load(list.Views);
|
||||
|
||||
var listView = list.Views.GetByTitle(lViewTitle);
|
||||
ctx.Load(listView, l => l.Id);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
var id = listView.Id;
|
||||
|
||||
listViewId.Add(lViewTitle, id.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Get List Id for Web Part");
|
||||
}
|
||||
|
||||
return listViewId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class ProjectYearService : IProjectYearService
|
||||
{
|
||||
private readonly ILogger<ProjectYearService> logger;
|
||||
private readonly IProjectService projectService;
|
||||
|
||||
public ProjectYearService(
|
||||
ILogger<ProjectYearService> logger,
|
||||
IProjectService projectService)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.projectService = projectService;
|
||||
}
|
||||
|
||||
public void CreateList(string projName, 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();
|
||||
|
||||
foreach (var fn in Fields.SiteFields)
|
||||
{
|
||||
var Fields = siteField.Fields.GetByInternalNameOrTitle(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.Title = listTitle;
|
||||
viewCreation.ViewTypeKind = ViewType.Html;
|
||||
viewCreation.ColumnWidth = "350";
|
||||
viewCreation.ViewFields = Fields.SiteFields;
|
||||
viewCreation.SetAsDefaultView = true;
|
||||
|
||||
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();
|
||||
|
||||
CreateViewList(list, ctx);
|
||||
|
||||
projectService.BuildWebParts(projName);
|
||||
|
||||
|
||||
Console.WriteLine($"> Impostata come HomePage di '{viewCreation.Title}'");
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Project Years");
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateViewList(List list, ClientContext ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (KeyValuePair<string, string> listTitle in Fields.SyntheticProjList)
|
||||
{
|
||||
Console.WriteLine($"> Inizializzata la fase di creazione della ListView '{listTitle}'.");
|
||||
|
||||
var views = list.Views;
|
||||
|
||||
ViewCreationInformation viewCreation = new ViewCreationInformation();
|
||||
|
||||
viewCreation.Title = listTitle.Key;
|
||||
viewCreation.ViewTypeKind = ViewType.Html;
|
||||
viewCreation.ColumnWidth = "350";
|
||||
viewCreation.ViewFields = Fields.SiteFields;
|
||||
viewCreation.Query = $"<Where>{listTitle.Value}</Where>";
|
||||
|
||||
var view = views.Add(viewCreation);
|
||||
|
||||
ctx.Load(view);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> Completata la fase di creazione della ListView '{viewCreation.Title}'.");
|
||||
|
||||
var customView = views.GetByTitle(viewCreation.Title);
|
||||
customView.MobileView = true;
|
||||
|
||||
customView.Update();
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'.");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Project Years");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Runtime.CompilerServices;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingOrderBuildService : IPurchasingOrderBuildService
|
||||
{
|
||||
private readonly ISiteOptions _siteOptions;
|
||||
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
|
||||
private readonly ISharePointCustomOperation _spc;
|
||||
private readonly IPurchasingOrderDocLibraryService _purchasingOrderDocLibraryService;
|
||||
private readonly IPurchasingOrderDocSetService _purchasingOrderDocSetService;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ILogger<PurchasingOrderBuildService> _logger;
|
||||
|
||||
public PurchasingOrderBuildService(ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ISharePointCustomOperation spc,
|
||||
IPurchasingOrderDocLibraryService purchasingOrderDocLibraryService,
|
||||
IPurchasingOrderDocSetService purchasingOrderDocSetService,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ILogger<PurchasingOrderBuildService> logger)
|
||||
{
|
||||
_siteOptions = siteOptions;
|
||||
_sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
_spc = spc;
|
||||
_purchasingOrderDocLibraryService = purchasingOrderDocLibraryService;
|
||||
_purchasingOrderDocSetService = purchasingOrderDocSetService;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void CreateIfNotExists(string purchasingOrder)
|
||||
{
|
||||
var site = _siteOptions.GetPurchasingOrderSite();
|
||||
var ctx = _sharePointAuthenticationManager.GetContext(site);
|
||||
var list = _siteOptions.GetPurchasingOrderLibrary(purchasingOrder);
|
||||
var tenant = _siteOptions.GetPurchasingOrderTenat();
|
||||
|
||||
if (!_spc.SiteExist(ctx))
|
||||
{
|
||||
throw new Exception($"Impossibile to build site it don't exist");
|
||||
}
|
||||
|
||||
if (!_spc.ListExist(ctx, list))
|
||||
{
|
||||
_purchasingOrderDocLibraryService.Create(list, ctx);
|
||||
}
|
||||
|
||||
if (!_spc.FolderExistsInsideList(ctx, list, purchasingOrder))
|
||||
{
|
||||
_purchasingOrderDocSetService.Create(purchasingOrder, list, tenant, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, list, purchasingOrder, FieldUpdateType.PurchasingOrder);
|
||||
_logger.LogInformation($"Quotation with {purchasingOrder} already exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingOrderDocLibraryService : IPurchasingOrderDocLibraryService
|
||||
{
|
||||
private readonly ILogger<PurchasingOrderDocLibraryService> _logger;
|
||||
|
||||
public PurchasingOrderDocLibraryService(ILogger<PurchasingOrderDocLibraryService> logger)
|
||||
{
|
||||
_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 = { "Fornitore", "Stato" };
|
||||
|
||||
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 = Fields.PurchasingView;
|
||||
|
||||
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 collegamento a {libName} è ora disponibile.");
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "NonComplianceDocLibraryService");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.DocumentSet;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingOrderDocSetService : IPurchasingOrderDocSetService
|
||||
{
|
||||
private readonly IPurchasingOrderRepository _purchasingOrderRepository;
|
||||
private readonly ISharePointCustomOperation _cpt;
|
||||
private readonly IOneNoteService _oneNoteService;
|
||||
private readonly ISiteOptions _siteOptions;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
|
||||
private readonly ILogger<PurchasingOrderBuildService> _logger;
|
||||
|
||||
public PurchasingOrderDocSetService(
|
||||
IPurchasingOrderRepository purchasingOrderRepository,
|
||||
ISharePointCustomOperation cpt,
|
||||
IOneNoteService oneNoteService,
|
||||
ISiteOptions siteOptions,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ILogger<PurchasingOrderBuildService> logger)
|
||||
{
|
||||
_purchasingOrderRepository = purchasingOrderRepository;
|
||||
_cpt = cpt;
|
||||
_oneNoteService = oneNoteService;
|
||||
_siteOptions = siteOptions;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
_sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Create(string purchasingOrderName, string docLibraryName, string tenantName, ClientContext ctx)
|
||||
{
|
||||
#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 {purchasingOrderName}.");
|
||||
|
||||
#region DocSet Field Entry
|
||||
|
||||
DocumentSet.Create(ctx, list.RootFolder, purchasingOrderName, contentType.Id);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> DocumentSet {purchasingOrderName} creata.");
|
||||
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, docLibraryName, purchasingOrderName, FieldUpdateType.PurchasingOrder);
|
||||
|
||||
Console.WriteLine($"> Field value update.");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Folder
|
||||
|
||||
foreach (var name in Folders.PurchasingOrder)
|
||||
{
|
||||
Console.WriteLine($"La sotto cartella {name} verrà creata in {purchasingOrderName}");
|
||||
var rPath = ResourcePath.FromDecodedUrl($"{purchasingOrderName}/{name}");
|
||||
list.RootFolder.AddSubFolderUsingPath(rPath);
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
var purchCtx = _sharePointAuthenticationManager.GetContext(_siteOptions.GetPurchasingSite());
|
||||
|
||||
_oneNoteService.CreateFolderInsidePurchasing(purchasingOrderName, purchCtx, PurchType.Order);
|
||||
|
||||
Console.WriteLine($"Le sotto cartelle sono state create con successo in {purchasingOrderName}");
|
||||
|
||||
#endregion
|
||||
|
||||
Console.WriteLine($"> {purchasingOrderName} creato con successo.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingPackingSlipBuildService : IPurchasingPackingSlipBuildService
|
||||
{
|
||||
private readonly ISiteOptions _siteOptions;
|
||||
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
|
||||
private readonly ISharePointCustomOperation _spc;
|
||||
private readonly IPurchasingPackingSlipDocLibraryService _purchasingPackingSlipDocLibraryService;
|
||||
private readonly IPurchasingPackingSlipDocSetService _purchasingPackingSlipDocSetService;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ILogger<PurchasingOrderBuildService> _logger;
|
||||
|
||||
public PurchasingPackingSlipBuildService(
|
||||
ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ISharePointCustomOperation spc,
|
||||
IPurchasingPackingSlipDocLibraryService purchasingPackingSlipDocLibraryService,
|
||||
IPurchasingPackingSlipDocSetService purchasingPackingSlipDocSetService,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ILogger<PurchasingOrderBuildService> logger)
|
||||
{
|
||||
_siteOptions = siteOptions;
|
||||
_sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
_spc = spc;
|
||||
_purchasingPackingSlipDocLibraryService = purchasingPackingSlipDocLibraryService;
|
||||
_purchasingPackingSlipDocSetService = purchasingPackingSlipDocSetService;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void CreateIfNotExists(string purchasingPackingSlipName)
|
||||
{
|
||||
var site = _siteOptions.GetPurchasingPackingSlipSite();
|
||||
var ctx = _sharePointAuthenticationManager.GetContext(site);
|
||||
var list = _siteOptions.GetPurchasingPackingSlipLibrary(purchasingPackingSlipName);
|
||||
var tenant = _siteOptions.GetPurchasingPackingSlipTenat();
|
||||
|
||||
if (!_spc.SiteExist(ctx))
|
||||
{
|
||||
throw new Exception($"Impossibile to build site it don't exist");
|
||||
}
|
||||
|
||||
if (!_spc.ListExist(ctx, list))
|
||||
{
|
||||
_purchasingPackingSlipDocLibraryService.Create(list, ctx);
|
||||
}
|
||||
|
||||
if (!_spc.FolderExistsInsideList(ctx, list, purchasingPackingSlipName))
|
||||
{
|
||||
_purchasingPackingSlipDocSetService.Create(purchasingPackingSlipName, list, tenant, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"Quotation with {purchasingPackingSlipName} already exist");
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, list, purchasingPackingSlipName, FieldUpdateType.PurchasingPackingSlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingPackingSlipDocLibraryService : IPurchasingPackingSlipDocLibraryService
|
||||
{
|
||||
private readonly ILogger<PurchasingPackingSlipDocLibraryService> _logger;
|
||||
|
||||
public PurchasingPackingSlipDocLibraryService(ILogger<PurchasingPackingSlipDocLibraryService> logger)
|
||||
{
|
||||
_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 = { "Fornitore", "Stato" };
|
||||
|
||||
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 = Fields.PurchasingView;
|
||||
|
||||
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 collegamento a {libName} è ora disponibile.");
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "NonComplianceDocLibraryService");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.DocumentSet;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingPackingSlipDocSetService : IPurchasingPackingSlipDocSetService
|
||||
{
|
||||
private readonly IPurchasingPackingSlipRepository _purchasingPackingSlipRepository;
|
||||
private readonly ISharePointCustomOperation _cpt;
|
||||
private readonly IOneNoteService _oneNoteService;
|
||||
private readonly ISiteOptions _siteOptions;
|
||||
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
|
||||
private readonly ILogger<PurchasingPackingSlipDocSetService> _logger;
|
||||
|
||||
public PurchasingPackingSlipDocSetService(
|
||||
IPurchasingPackingSlipRepository purchasingPackingSlipRepository,
|
||||
ISharePointCustomOperation cpt,
|
||||
IOneNoteService oneNoteService,
|
||||
ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ILogger<PurchasingPackingSlipDocSetService> logger)
|
||||
{
|
||||
_purchasingPackingSlipRepository = purchasingPackingSlipRepository;
|
||||
_cpt = cpt;
|
||||
_oneNoteService = oneNoteService;
|
||||
_siteOptions = siteOptions;
|
||||
_sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
_logger = logger;
|
||||
}
|
||||
public void Create(string purchasingPackingSlipName, string docLibraryName, string tenantName, ClientContext ctx)
|
||||
{
|
||||
#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 {purchasingPackingSlipName}.");
|
||||
|
||||
#region DocSet Field Entry
|
||||
|
||||
DocumentSet.Create(ctx, list.RootFolder, purchasingPackingSlipName, contentType.Id);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> DocumentSet {purchasingPackingSlipName} creata.");
|
||||
var dsItem = list.RootFolder.Folders.GetByUrl(purchasingPackingSlipName).ListItemAllFields;
|
||||
|
||||
dsItem["PAL_PO_Supplier"] = _purchasingPackingSlipRepository.DefaultPurchasingPackingSlipSupplier(purchasingPackingSlipName);
|
||||
dsItem["PAL_Status"] = _purchasingPackingSlipRepository.DefaultPurchasingPackingSlipState(purchasingPackingSlipName);
|
||||
|
||||
dsItem.Update();
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> Field value update.");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Folder
|
||||
|
||||
//foreach (var name in Folders.PurchasingOrder)
|
||||
//{
|
||||
// Console.WriteLine($"La sotto cartella {name} verrà creata in {nonComplianceName}");
|
||||
// var rPath = ResourcePath.FromDecodedUrl($"{nonComplianceName}/{name}");
|
||||
// list.RootFolder.AddSubFolderUsingPath(rPath);
|
||||
//}
|
||||
|
||||
//ctx.ExecuteQuery();
|
||||
|
||||
var purchCtx = _sharePointAuthenticationManager.GetContext(_siteOptions.GetPurchasingSite());
|
||||
|
||||
|
||||
_oneNoteService.CreateFolderInsidePurchasing(purchasingPackingSlipName, purchCtx, PurchType.PackingSlip);
|
||||
|
||||
Console.WriteLine($"Le sotto cartelle sono state create con successo in {purchasingPackingSlipName}");
|
||||
|
||||
#endregion
|
||||
|
||||
Console.WriteLine($"> {purchasingPackingSlipName} creato con successo.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingRequestBuildService : IPurchasingRequestBuildService
|
||||
{
|
||||
private readonly ISiteOptions _siteOptions;
|
||||
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
|
||||
private readonly ISharePointCustomOperation _spc;
|
||||
private readonly IPurchasingRequestDocLibraryService _purchasingRequestDocLibraryService;
|
||||
private readonly IPurchasingRequestDocSetService _purchasingRequestDocSetService;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ILogger<PurchasingRequestBuildService> _logger;
|
||||
|
||||
public PurchasingRequestBuildService(ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ISharePointCustomOperation spc,
|
||||
IPurchasingRequestDocLibraryService purchasingRequestDocLibraryService,
|
||||
IPurchasingRequestDocSetService purchasingRequestDocSetService,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ILogger<PurchasingRequestBuildService> logger)
|
||||
{
|
||||
_siteOptions = siteOptions;
|
||||
_sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
_spc = spc;
|
||||
_purchasingRequestDocLibraryService = purchasingRequestDocLibraryService;
|
||||
_purchasingRequestDocSetService = purchasingRequestDocSetService;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void CreateIfNotExists(string purchasingRequestName)
|
||||
{
|
||||
var site = _siteOptions.GetPurchasingRequestSite();
|
||||
var ctx = _sharePointAuthenticationManager.GetContext(site);
|
||||
var list = _siteOptions.GetPurchasingRequestLibrary(purchasingRequestName);
|
||||
var tenant = _siteOptions.GetPurchasingRequestTenat();
|
||||
|
||||
if (!_spc.SiteExist(ctx))
|
||||
{
|
||||
throw new Exception($"Impossibile to build site it don't exist");
|
||||
}
|
||||
|
||||
if (!_spc.ListExist(ctx, list))
|
||||
{
|
||||
_purchasingRequestDocLibraryService.Create(list, ctx);
|
||||
}
|
||||
|
||||
if (!_spc.FolderExistsInsideList(ctx, list, purchasingRequestName))
|
||||
{
|
||||
_purchasingRequestDocSetService.Create(purchasingRequestName, list, tenant, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"Quotation with {purchasingRequestName} already exist");
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, list, purchasingRequestName, FieldUpdateType.PurchasingRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingRequestDocLibraryService : IPurchasingRequestDocLibraryService
|
||||
{
|
||||
private readonly ILogger<PurchasingRequestDocLibraryService> _logger;
|
||||
|
||||
public PurchasingRequestDocLibraryService(ILogger<PurchasingRequestDocLibraryService> logger)
|
||||
{
|
||||
_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 = { "Fornitore", "Stato" };
|
||||
|
||||
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 = Fields.PurchasingView;
|
||||
|
||||
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 collegamento a {libName} è ora disponibile.");
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "NonComplianceDocLibraryService");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.DocumentSet;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class PurchasingRequestDocSetService : IPurchasingRequestDocSetService
|
||||
{
|
||||
private readonly IPurchasingRequestRepository _purchasingRequestRepository;
|
||||
private readonly ISharePointCustomOperation _cpt;
|
||||
private readonly IOneNoteService _oneNoteService;
|
||||
private readonly ISiteOptions _siteOptions;
|
||||
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ILogger<PurchasingRequestDocSetService> _logger;
|
||||
|
||||
public PurchasingRequestDocSetService(
|
||||
IPurchasingRequestRepository purchasingRequestRepository,
|
||||
ISharePointCustomOperation cpt,
|
||||
IOneNoteService oneNoteService,
|
||||
ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ILogger<PurchasingRequestDocSetService> logger)
|
||||
{
|
||||
_purchasingRequestRepository = purchasingRequestRepository;
|
||||
_cpt = cpt;
|
||||
_oneNoteService = oneNoteService;
|
||||
_siteOptions = siteOptions;
|
||||
_sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Create(string purchasingRequestName, string docLibraryName, string tenantName, ClientContext ctx)
|
||||
{
|
||||
#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 {purchasingRequestName}.");
|
||||
|
||||
#region DocSet Field Entry
|
||||
|
||||
DocumentSet.Create(ctx, list.RootFolder, purchasingRequestName, contentType.Id);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> DocumentSet {purchasingRequestName} creata.");
|
||||
|
||||
//var dsItem = list.RootFolder.Folders.GetByUrl(purchasingRequestName).ListItemAllFields;
|
||||
|
||||
//dsItem["PAL_PO_Supplier"] = _purchasingRequestRepository.DefaultPurchasingRequestSupplier(purchasingRequestName);
|
||||
//dsItem["PAL_Status"] = _purchasingRequestRepository.DefaultPurchasingRequestState(purchasingRequestName);
|
||||
|
||||
//dsItem.Update();
|
||||
//ctx.ExecuteQuery();
|
||||
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, docLibraryName, purchasingRequestName, FieldUpdateType.PurchasingRequest);
|
||||
|
||||
Console.WriteLine($"> Field value update.");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Folder
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
var purchCtx = _sharePointAuthenticationManager.GetContext(_siteOptions.GetPurchasingSite());
|
||||
|
||||
_oneNoteService.CreateFolderInsidePurchasing(purchasingRequestName, purchCtx, PurchType.Request);
|
||||
|
||||
Console.WriteLine($"Le sotto cartelle sono state create con successo in {purchasingRequestName}");
|
||||
|
||||
#endregion
|
||||
|
||||
Console.WriteLine($"> {purchasingRequestName} creato con successo.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal 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 IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ILogger<QuotationBuildService> logger;
|
||||
|
||||
public QuotationBuildService(
|
||||
ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ISharePointCustomOperation spc,
|
||||
ITenantService tenantService,
|
||||
IQuotationDocLibraryService quotationDocLibraryService,
|
||||
IQuotationDocSetService quotationDocSetService,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ILogger<QuotationBuildService> logger)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
this.sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
this.spc = spc;
|
||||
this.tenantService = tenantService;
|
||||
this.quotationDocLibraryService = quotationDocLibraryService;
|
||||
this.quotationDocSetService = quotationDocSetService;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public void CreateIfNotExists(string quotationName)
|
||||
{
|
||||
var site = siteOptions.GetQuotationSite();
|
||||
var ctx = sharePointAuthenticationManager.GetContext(site);
|
||||
var list = siteOptions.GetQuotationLibrary(quotationName);
|
||||
var tenant = siteOptions.GetQuotationTenant();
|
||||
|
||||
if (!spc.SiteExist(ctx))
|
||||
{
|
||||
tenantService.CreateForQuotation();
|
||||
}
|
||||
|
||||
if (!spc.ListExist(ctx, list))
|
||||
{
|
||||
quotationDocLibraryService.Create(list, ctx);
|
||||
}
|
||||
|
||||
if (!spc.FolderExistsInsideList(ctx, list, quotationName))
|
||||
{
|
||||
quotationDocSetService.Create(quotationName, list, tenant, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation($"Quotation with {quotationName} already exist");
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, list, quotationName, FieldUpdateType.Quotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal 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 = { "PAL_Quotation_Reason", "PAL_ID_Quotation", "PAL_Quotation_Name", "PAL_Description", "PAL_Authors", "PAL_Status" };
|
||||
|
||||
foreach (var fn in fieldName)
|
||||
{
|
||||
var Fields = siteField.Fields.GetByInternalNameOrTitle(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 = Fields.QuotationView;
|
||||
|
||||
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 collegamento a {libName} è ora disponibile.");
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "QuotationDocLibraryService");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.DocumentSet;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class QuotationDocSetService : IQuotationDocSetService
|
||||
{
|
||||
private readonly ISharePointCustomOperation cpt;
|
||||
private readonly ILogger<QuotationDocSetService> logger;
|
||||
private readonly IOneNoteService oneNoteService;
|
||||
private readonly IQuotationRepository quotationRepository;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
|
||||
public QuotationDocSetService(ISharePointCustomOperation cpt,
|
||||
ILogger<QuotationDocSetService> logger,
|
||||
IOneNoteService oneNoteService,
|
||||
IQuotationRepository quotationRepository,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate)
|
||||
{
|
||||
this.cpt = cpt;
|
||||
this.logger = logger;
|
||||
this.oneNoteService = oneNoteService;
|
||||
this.quotationRepository = quotationRepository;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
}
|
||||
|
||||
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"] = quotationRepository.DefaultIdQuotation(quotationName);
|
||||
//dsItem["PAL_Quotation_Name"] = quotationRepository.DefaultQuotationName(quotationName);
|
||||
//dsItem["PAL_Quotation_Reason"] = quotationRepository.DefaultQuotationReason(quotationName);
|
||||
//dsItem["PAL_Authors"] = quotationRepository.DefaultAuthors(quotationName);
|
||||
//dsItem["PAL_Status"] = quotationRepository.DefaultQuotationState(quotationName);
|
||||
|
||||
//dsItem.Update();
|
||||
//ctx.ExecuteQuery();
|
||||
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, docLibraryName, quotationName, FieldUpdateType.Quotation);
|
||||
|
||||
Console.WriteLine($"> Field value update.");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Quotation Folder
|
||||
|
||||
var revision = "Rev.00";
|
||||
|
||||
foreach (var name in Folders.OfferDocSet(revision))
|
||||
{
|
||||
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, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services
|
||||
{
|
||||
internal 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" }
|
||||
};
|
||||
|
||||
var itsAdGruopNCRole = new Dictionary<string, string>()
|
||||
{
|
||||
{ "ITS-SPO-NC-OWNER", "Full Control" },
|
||||
{ "ITS-SPO-NC-MODIFY", "Edit" },
|
||||
{ "ITS-SPO-NC-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 (tenantName.Contains("Conformità"))
|
||||
{
|
||||
#region Site Permission Quotation
|
||||
var web = ctx.Web;
|
||||
|
||||
foreach (var role in itsAdGruopNCRole)
|
||||
{
|
||||
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,172 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services
|
||||
{
|
||||
internal 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.LogWarning("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.LogWarning("List Exist", ex);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool FolderExist(ClientContext ctx, string path)
|
||||
{
|
||||
var folder = ctx.Web.GetFolderByServerRelativeUrl(path).Folders;
|
||||
ctx.Load(folder, f => f.Include(fi => fi.ListItemAllFields));
|
||||
|
||||
try
|
||||
{
|
||||
ctx.ExecuteQuery();
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
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.LogWarning("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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void PalCustomField(ClientContext ctx, PalFieldType et)
|
||||
{
|
||||
var fieldList = et switch
|
||||
{
|
||||
PalFieldType.Project => Fields.ProjectCustomFields,
|
||||
PalFieldType.Quotation => Fields.QuotationCustomFields,
|
||||
PalFieldType.NonCompliance => Fields.NonComplianceCustomFields,
|
||||
_ => 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,145 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class SharePointStructureBuilderService : ISharePointStructureBuilder
|
||||
{
|
||||
private readonly ISiteOptions siteOptions;
|
||||
private readonly ISiteService siteService;
|
||||
private readonly ISubProjectRepository subProjectRepository;
|
||||
private readonly ISubProjectBuilderService subProjectBuilderService;
|
||||
private readonly IQuotationBuildService quotationBuildService;
|
||||
private readonly INonComplianceBuildService nonComplianceBuildService;
|
||||
private readonly IPurchasingOrderBuildService purchasingOrderBuildService;
|
||||
private readonly IPurchasingPackingSlipBuildService purchasingPackingSlipBuildService;
|
||||
private readonly IPurchasingRequestBuildService purchasingRequestBuildService;
|
||||
private readonly IWebpartService webpartService;
|
||||
|
||||
public SharePointStructureBuilderService(
|
||||
ISiteOptions siteOptions,
|
||||
ISiteService siteService,
|
||||
ISubProjectRepository subProjectRepository,
|
||||
ISubProjectBuilderService subProjectBuilderService,
|
||||
IQuotationBuildService quotationBuildService,
|
||||
INonComplianceBuildService nonComplianceBuildService,
|
||||
IPurchasingOrderBuildService purchasingOrderBuildService,
|
||||
IPurchasingPackingSlipBuildService purchasingPackingSlipBuildService,
|
||||
IPurchasingRequestBuildService purchasingRequestBuildService,
|
||||
IWebpartService webpartService)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
this.siteService = siteService;
|
||||
this.subProjectRepository = subProjectRepository;
|
||||
this.subProjectBuilderService = subProjectBuilderService;
|
||||
this.quotationBuildService = quotationBuildService;
|
||||
this.nonComplianceBuildService = nonComplianceBuildService;
|
||||
this.purchasingOrderBuildService = purchasingOrderBuildService;
|
||||
this.purchasingPackingSlipBuildService = purchasingPackingSlipBuildService;
|
||||
this.purchasingRequestBuildService = purchasingRequestBuildService;
|
||||
this.webpartService = webpartService;
|
||||
}
|
||||
|
||||
|
||||
public bool BuildProject(string projName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(projName))
|
||||
{
|
||||
throw new Exception(projName + " is not valid, return year " + siteOptions.GetYear(projName));
|
||||
}
|
||||
|
||||
var siteBuilderResult = siteService.CreateProjectSiteIfNotExists(projName);
|
||||
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)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(quotationName))
|
||||
{
|
||||
throw new Exception(quotationName + " is not valid, return year " + siteOptions.GetYear(quotationName));
|
||||
}
|
||||
|
||||
var siteBuildResult = siteService.CreateQuotationSiteIfNotExists(quotationName);
|
||||
if (!siteBuildResult)
|
||||
{
|
||||
throw new Exception($"Impossibile to build site");
|
||||
}
|
||||
|
||||
quotationBuildService.CreateIfNotExists(quotationName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool BuildNonCompliance(string nonComplianceName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(nonComplianceName))
|
||||
{
|
||||
throw new Exception(nonComplianceName + " is not valid, return year " + siteOptions.GetYear(nonComplianceName));
|
||||
}
|
||||
|
||||
var siteBuildResult = siteService.CreateNonComplianceSiteIfNotExists(nonComplianceName);
|
||||
if (!siteBuildResult)
|
||||
{
|
||||
throw new Exception($"Impossibile to build site");
|
||||
}
|
||||
|
||||
nonComplianceBuildService.CreateIfNotExists(nonComplianceName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool BuildPurchasingOrder(string purchasingOrderName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(purchasingOrderName))
|
||||
{
|
||||
throw new Exception(purchasingOrderName + " is not valid, return year " + siteOptions.GetYear(purchasingOrderName));
|
||||
}
|
||||
|
||||
purchasingOrderBuildService.CreateIfNotExists(purchasingOrderName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool BuildPurchasingPackingSlip(string purchasingPackingSlipName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(purchasingPackingSlipName))
|
||||
{
|
||||
throw new Exception(purchasingPackingSlipName + " is not valid, return year " + siteOptions.GetYear(purchasingPackingSlipName));
|
||||
}
|
||||
|
||||
purchasingPackingSlipBuildService.CreateIfNotExists(purchasingPackingSlipName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool BuildPurchasingRequest(string purchasingRequestName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(purchasingRequestName))
|
||||
{
|
||||
throw new Exception(purchasingRequestName + " is not valid, return year " + siteOptions.GetYear(purchasingRequestName));
|
||||
}
|
||||
|
||||
purchasingRequestBuildService.CreateIfNotExists(purchasingRequestName);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
using System.Net;
|
||||
using System.Security;
|
||||
using System.Text.RegularExpressions;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Graph;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
public class SiteOptions : ISiteOptions
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public SiteOptions(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
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 int ZeroDate { get; } = 2022;
|
||||
|
||||
public Uri GetProjectYearSite(string code)
|
||||
{
|
||||
return new Uri($"{SiteCollection}/sites/{GetProjYearTenant(code).Replace(" ","")}");
|
||||
}
|
||||
|
||||
public string GetYear(string code)
|
||||
{
|
||||
var codeHeader = code.Split("-")[0];
|
||||
var codeYears = Regex.Replace(codeHeader, @"\D", "");
|
||||
var currentCent = DateTime.Today.Year.ToString().Substring(0, 2);
|
||||
|
||||
return currentCent + codeYears;
|
||||
}
|
||||
|
||||
public bool IsValidDate(string code)
|
||||
{
|
||||
int zeroDate = ZeroDate;
|
||||
int retDate = int.Parse(GetYear(code));
|
||||
int curDate = int.Parse(DateTime.Now.Year.ToString());
|
||||
|
||||
if (zeroDate <= retDate && retDate <= curDate)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string GetProjYearTenant(string code)
|
||||
{
|
||||
return $"Commesse {GetYear(code)}";
|
||||
}
|
||||
|
||||
public string GetUser()
|
||||
{
|
||||
return "svcItsSharePointAdmin@italsort.com";
|
||||
}
|
||||
|
||||
public SecureString GetPassword()
|
||||
{
|
||||
return new NetworkCredential("", "$O,D1XBp1O5.OdjZt86#a=").SecurePassword;
|
||||
}
|
||||
|
||||
public string GetProjListTitle(string code)
|
||||
{
|
||||
return $"Lista {GetProjYearTenant(code)}";
|
||||
}
|
||||
|
||||
public Uri GetSubProjSite(string projName)
|
||||
{
|
||||
return new Uri($"{GetProjectYearSite(projName)}/{projName}");
|
||||
}
|
||||
|
||||
public string GetQuotationTenant()
|
||||
{
|
||||
return "Offerte";
|
||||
}
|
||||
|
||||
public string GetQuotationLibrary(string code)
|
||||
{
|
||||
return $"{GetQuotationTenant()} {GetYear(code)}";
|
||||
}
|
||||
|
||||
public Uri GetQuotationSite()
|
||||
{
|
||||
return new Uri($"{SiteCollection}/sites/{GetQuotationTenant()}");
|
||||
}
|
||||
|
||||
public string GetSubProjList(string projName)
|
||||
{
|
||||
return $"SottoCommesse {projName}";
|
||||
}
|
||||
|
||||
private string GetProjectTenant()
|
||||
{
|
||||
return "Commesse";
|
||||
}
|
||||
|
||||
public Uri GetProjectSite()
|
||||
{
|
||||
return new Uri($"{SiteCollection}/sites/{GetProjectTenant()}");
|
||||
}
|
||||
|
||||
public string GetNonComplianceTenant()
|
||||
{
|
||||
return "Non Conformità";
|
||||
}
|
||||
|
||||
public string GetNonComplianceLibrary(string code)
|
||||
{
|
||||
return $"{GetNonComplianceTenant()} {GetYear(code)}";
|
||||
}
|
||||
|
||||
public Uri GetNonComplianceSite()
|
||||
{
|
||||
return new Uri($"{SiteCollection}/sites/{GetNonComplianceTenant().Replace(" ", string.Empty)}");
|
||||
}
|
||||
|
||||
public Uri GetPurchasingSite()
|
||||
{
|
||||
return new Uri($"{SiteCollection}/teams/purchasing/");
|
||||
}
|
||||
|
||||
public string GetPurchasingOrderTenat()
|
||||
{
|
||||
return "Ordini di Acquisto";
|
||||
}
|
||||
|
||||
public string GetPurchasingOrderLibrary(string code)
|
||||
{
|
||||
return $"{GetPurchasingOrderTenat()} {GetYear(code)}";
|
||||
}
|
||||
|
||||
public Uri GetPurchasingOrderSite()
|
||||
{
|
||||
return new Uri($"{SiteCollection}/teams/purchasing/{GetPurchasingOrderTenat().Replace(" ", string.Empty)}");
|
||||
}
|
||||
|
||||
public string GetPurchasingPackingSlipTenat()
|
||||
{
|
||||
return "DDT di Acquisto";
|
||||
}
|
||||
|
||||
public string GetPurchasingPackingSlipLibrary(string code)
|
||||
{
|
||||
return $"{GetPurchasingPackingSlipTenat()} {GetYear(code)}";
|
||||
}
|
||||
|
||||
public Uri GetPurchasingPackingSlipSite()
|
||||
{
|
||||
return new Uri($"{SiteCollection}/teams/purchasing/{GetPurchasingPackingSlipTenat().Replace(" ", string.Empty)}");
|
||||
}
|
||||
|
||||
public string GetPurchasingRequestTenat()
|
||||
{
|
||||
return "Richieste di Acquisto";
|
||||
}
|
||||
|
||||
public string GetPurchasingRequestLibrary(string code)
|
||||
{
|
||||
return $"{GetPurchasingRequestTenat()} {GetYear(code)}";
|
||||
}
|
||||
|
||||
public Uri GetPurchasingRequestSite()
|
||||
{
|
||||
return new Uri($"{SiteCollection}/teams/purchasing/{GetPurchasingRequestTenat().Replace(" ", string.Empty)}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal 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 IProjectRepository _projectRepository;
|
||||
private readonly IProjectDocLibraryService _projectDocLibraryService;
|
||||
private readonly IProjectQuickMenuService _projectQuickMenuService;
|
||||
private readonly ITenantService _tenantService;
|
||||
private readonly IProjectYearService _projectYearService;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
|
||||
public SiteService(
|
||||
ILogger<SiteService> logger,
|
||||
ISharePointAuthenticationManager authMgr,
|
||||
ISharePointCustomOperation spc,
|
||||
ISiteOptions siteOptions,
|
||||
ISubSiteService subSiteService,
|
||||
IOneNoteService oneNoteService,
|
||||
IProjectRepository projectRepository,
|
||||
IProjectDocLibraryService projectDocLibraryService,
|
||||
IProjectQuickMenuService projectQuickMenuService,
|
||||
ITenantService tenantService,
|
||||
IProjectYearService projectYearService,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate)
|
||||
{
|
||||
_logger = logger;
|
||||
_authMgr = authMgr;
|
||||
_spc = spc;
|
||||
_siteOptions = siteOptions;
|
||||
_subSiteService = subSiteService;
|
||||
_oneNoteService = oneNoteService;
|
||||
_projectRepository = projectRepository;
|
||||
_projectDocLibraryService = projectDocLibraryService;
|
||||
_projectQuickMenuService = projectQuickMenuService;
|
||||
_tenantService = tenantService;
|
||||
_projectYearService = projectYearService;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
}
|
||||
|
||||
public bool CreateProjectSiteIfNotExists(string projName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var site = _siteOptions.GetProjectYearSite(projName);
|
||||
var listTitle = _siteOptions.GetProjListTitle(projName);
|
||||
using var ctx = _authMgr.GetContext(site);
|
||||
if (_spc.SiteExist(ctx))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_tenantService.CreateForProject(projName);
|
||||
_projectYearService.CreateList(projName, listTitle, ctx);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, "Site Service");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CreateSubSiteIfNotExists(string projName)
|
||||
{
|
||||
|
||||
var projectSite = _siteOptions.GetProjectYearSite(projName);
|
||||
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");
|
||||
_fieldEntryDataUpdate.FieldUpdate(siteContext, _siteOptions.GetProjListTitle(projName), projName, FieldUpdateType.Project);
|
||||
|
||||
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(string quotationName)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
public bool CreateNonComplianceSiteIfNotExists(string nonComplianceName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var site = _siteOptions.GetNonComplianceSite();
|
||||
using var ctx = _authMgr.GetContext(site);
|
||||
if (_spc.SiteExist(ctx))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_tenantService.CreateForNonCompliance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, "Site Service");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateProjectListEntry(string projName, ClientContext ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
var listTitle = _siteOptions.GetProjListTitle(projName);
|
||||
var tenant = _siteOptions.GetProjYearTenant(projName).Replace(" ",string.Empty);
|
||||
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.Update();
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, listTitle, projName, FieldUpdateType.Project);
|
||||
|
||||
_logger.LogInformation($"> La Commessa {projName} è stata aggiunta alla lista {listTitle} con successo!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Create List Entry");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
using library_spo_utils.Constants;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.DocumentSet;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class SubProjectBuilderService : ISubProjectBuilderService
|
||||
{
|
||||
private readonly ISiteOptions siteOptions;
|
||||
private readonly ISharePointCustomOperation cpt;
|
||||
private readonly ISharePointAuthenticationManager authMgr;
|
||||
private readonly ISubProjectRepository subProjectRepository;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ILogger<SubProjectBuilderService> logger;
|
||||
|
||||
public SubProjectBuilderService(ISiteOptions siteOptions,
|
||||
ISharePointCustomOperation cpt,
|
||||
ISharePointAuthenticationManager authMgr,
|
||||
ISubProjectRepository subProjectRepository,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ILogger<SubProjectBuilderService> logger)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
this.cpt = cpt;
|
||||
this.authMgr = authMgr;
|
||||
this.subProjectRepository = subProjectRepository;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
|
||||
public bool SubProjectDocSet(string projName, List<string> listOfSubProjIds)
|
||||
{
|
||||
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 subProjId in listOfSubProjIds)
|
||||
{
|
||||
if (cpt.FolderExistsInsideList(ctx, listTitle, subProjId))
|
||||
{
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, listTitle, projName, FieldUpdateType.SubProject);
|
||||
continue;
|
||||
}
|
||||
Console.WriteLine($"> Inizializzata la fase di creazione per {subProjId}.");
|
||||
|
||||
#region DocSet Field Entry
|
||||
|
||||
DocumentSet.Create(ctx, list.RootFolder, subProjId, contentType.Id);
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"> DocumentSet {subProjId} creata.");
|
||||
|
||||
//var dsItem = list.RootFolder.Folders.GetByUrl(subProjId).ListItemAllFields;
|
||||
|
||||
//dsItem["_ExtendedDescription"] = subProjectRepository.DefaultDescription(projName);
|
||||
//dsItem["PAL_Item"] = subProjectRepository.DefaultItem(projName);
|
||||
//dsItem["PAL_ItemCode"] = subProjectRepository.DefaultItemCode(projName);
|
||||
//dsItem["PAL_ItemDescription"] = subProjectRepository.DefaultItemDescription(projName);
|
||||
//dsItem["PAL_SerialNumber"] = subProjectRepository.DefaultSerialNumber(projName);
|
||||
//dsItem["PAL_Status"] = subProjectRepository.DefaultState(projName);
|
||||
|
||||
//dsItem.Update();
|
||||
//ctx.ExecuteQuery();
|
||||
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, listTitle, subProjId, FieldUpdateType.SubProject);
|
||||
|
||||
Console.WriteLine($"> Field value update.");
|
||||
|
||||
#endregion
|
||||
|
||||
#region SubProject Folder
|
||||
|
||||
foreach (var name in Folders.SubProjectDocSet)
|
||||
{
|
||||
Console.WriteLine($"La sotto cartella {name} verrà creata in {subProjId}");
|
||||
var rPath = ResourcePath.FromDecodedUrl($"{subProjId}/{name}");
|
||||
list.RootFolder.AddSubFolderUsingPath(rPath);
|
||||
}
|
||||
|
||||
ctx.ExecuteQuery();
|
||||
|
||||
Console.WriteLine($"Le sotto cartelle sono state create con successo in {subProjId}");
|
||||
|
||||
#endregion
|
||||
|
||||
Console.WriteLine($"> {subProjId} 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 library_spo_utils.Constants;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class SubSiteService : ISubSiteService
|
||||
{
|
||||
private readonly ILogger<SubSiteService> logger;
|
||||
private readonly IProjectQuickMenuService projectQuickMenuService;
|
||||
|
||||
public SubSiteService(ILogger<SubSiteService> logger,
|
||||
IProjectQuickMenuService projectQuickMenuService)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.projectQuickMenuService = projectQuickMenuService;
|
||||
}
|
||||
|
||||
|
||||
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 = Fields.SubProject
|
||||
};
|
||||
|
||||
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.SubSiteProject)
|
||||
{
|
||||
var fields = siteField.Fields.GetByInternalNameOrTitle(fieldName);
|
||||
list.Fields.Add(fields);
|
||||
}
|
||||
ctx.ExecuteQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Online.SharePoint.TenantAdministration;
|
||||
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal 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(string projName)
|
||||
{
|
||||
TenantCreation(
|
||||
siteOptions.GetProjYearTenant(projName),
|
||||
siteOptions.GetProjectYearSite(projName),
|
||||
PalFieldType.Project
|
||||
);
|
||||
}
|
||||
|
||||
public void CreateForQuotation()
|
||||
{
|
||||
TenantCreation(
|
||||
siteOptions.GetQuotationTenant(),
|
||||
siteOptions.GetQuotationSite(),
|
||||
PalFieldType.Quotation
|
||||
);
|
||||
}
|
||||
|
||||
public void CreateForNonCompliance()
|
||||
{
|
||||
TenantCreation(
|
||||
siteOptions.GetNonComplianceTenant(),
|
||||
siteOptions.GetNonComplianceSite(),
|
||||
PalFieldType.NonCompliance
|
||||
);
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using Microsoft.SharePoint.Client.WebParts;
|
||||
|
||||
namespace library_spo_utils.Services
|
||||
{
|
||||
internal class WebpartService : IWebpartService
|
||||
{
|
||||
private readonly ILogger<WebpartService> logger;
|
||||
private readonly ISharePointAuthenticationManager authMgr;
|
||||
private readonly ISiteOptions siteOptions;
|
||||
|
||||
public WebpartService(
|
||||
ILogger<WebpartService> logger,
|
||||
ISharePointAuthenticationManager authMgr,
|
||||
ISiteOptions siteOptions)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.authMgr = authMgr;
|
||||
this.siteOptions = siteOptions;
|
||||
}
|
||||
|
||||
public void AddWebPart(Web web, LimitedWebPartManager mgr, string xmlSchema, string listName, string zoneName, int zoneId)
|
||||
{
|
||||
try
|
||||
{
|
||||
WebPartDefinition def = mgr.ImportWebPart(xmlSchema);
|
||||
def.WebPart.Hidden = false;
|
||||
mgr.AddWebPart(def.WebPart, zoneName, zoneId);
|
||||
mgr.Context.ExecuteQuery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Project Years");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace library_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)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
//var buildProjectsResult = structureBuilder.BuildProject("CT22-TEST");
|
||||
|
||||
//if (!buildProjectsResult)
|
||||
//{
|
||||
// logger.LogError("Impossible to create structure");
|
||||
// return;
|
||||
//}
|
||||
|
||||
//var buildQuotationResult = structureBuilder.BuildQuotation("OF23-TEST");
|
||||
|
||||
//if (!buildQuotationResult)
|
||||
//{
|
||||
// logger.LogError("Impossible to create structure");
|
||||
// return;
|
||||
//}
|
||||
|
||||
//var buildNonComplianceResult = structureBuilder.BuildNonCompliance("NC22-TEST");
|
||||
|
||||
//if (!buildNonComplianceResult)
|
||||
//{
|
||||
// logger.LogError("Impossible to create structure");
|
||||
// return;
|
||||
//}
|
||||
|
||||
//var buildPurchasingOrderResult = structureBuilder.BuildPurchasingOrder("PO22-TEST");
|
||||
|
||||
//if (!buildPurchasingOrderResult)
|
||||
//{
|
||||
// logger.LogError("Impossible to create structure");
|
||||
// return;
|
||||
//}
|
||||
|
||||
//var buildPurchasingPackingSlipResult = structureBuilder.BuildPurchasingPackingSlip("DA22-TEST");
|
||||
|
||||
//if (!buildPurchasingPackingSlipResult)
|
||||
//{
|
||||
// logger.LogError("Impossible to create structure");
|
||||
// return;
|
||||
//}
|
||||
|
||||
//var buildPurchasingResquestResult = structureBuilder.BuildPurchasingRequest("RDA22-TEST");
|
||||
|
||||
//if (!buildPurchasingResquestResult)
|
||||
//{
|
||||
// logger.LogError("Impossible to create structure");
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
+568
@@ -8,9 +8,13 @@
|
||||
".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.SharePoint.Client.Online.CSOM": "15.0.4919.1000",
|
||||
"Microsoft.SharePointOnline.CSOM": "16.1.22615.12000",
|
||||
"PnP.Core": "1.7.0",
|
||||
"PnP.Core.Admin": "1.7.0",
|
||||
@@ -33,6 +37,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 +381,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 +404,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 +503,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 +616,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 +715,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"
|
||||
@@ -606,6 +923,53 @@
|
||||
}
|
||||
},
|
||||
"Microsoft.SharePoint.Client/14.0.4762.1000": {},
|
||||
"Microsoft.SharePoint.Client.Online.CSOM/15.0.4919.1000": {
|
||||
"dependencies": {
|
||||
"SharePoint.Client.Office.Tools": "15.0.4907.1000"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net40-full/Microsoft.SharePoint.ApplicationPages.Administration.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4907.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.SharePoint.ApplicationPages.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4911.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.SharePoint.Client.ServerRuntime.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4905.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.SharePoint.DesignTime.Activities.dll": {
|
||||
"assemblyVersion": "14.0.0.0",
|
||||
"fileVersion": "14.0.23928.0"
|
||||
},
|
||||
"lib/net40-full/Microsoft.SharePoint.Portal.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4917.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.SharePoint.Publishing.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4907.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.SharePoint.Security.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4420.1017"
|
||||
},
|
||||
"lib/net40-full/Microsoft.SharePoint.Taxonomy.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4911.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.SharePoint.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4919.1003"
|
||||
},
|
||||
"lib/net40-full/Microsoft.Sharepoint.WorkflowActions.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4857.1000"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.SharePointOnline.CSOM/16.1.22615.12000": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.Office.Client.Policy.dll": {
|
||||
@@ -839,6 +1203,34 @@
|
||||
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.2": {},
|
||||
"SharePoint.Client.Office.Tools/15.0.4907.1000": {
|
||||
"runtime": {
|
||||
"lib/net40-full/Microsoft.Office.Client.Education.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4420.1017"
|
||||
},
|
||||
"lib/net40-full/Microsoft.Office.DocumentManagement.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4885.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.Office.Policy.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4891.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.Office.Server.Search.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4917.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.Office.Server.UserProfiles.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4907.1000"
|
||||
},
|
||||
"lib/net40-full/Microsoft.Office.Server.dll": {
|
||||
"assemblyVersion": "15.0.0.0",
|
||||
"fileVersion": "15.0.4907.1000"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SharePointPnP.IdentityModel.Extensions/1.2.4": {
|
||||
"dependencies": {
|
||||
"Microsoft.IdentityModel": "6.1.7600.16394"
|
||||
@@ -942,6 +1334,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 +2270,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 +2417,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 +2431,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 +2487,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 +2543,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 +2592,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,
|
||||
@@ -2171,6 +2718,13 @@
|
||||
"path": "microsoft.sharepoint.client/14.0.4762.1000",
|
||||
"hashPath": "microsoft.sharepoint.client.14.0.4762.1000.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.SharePoint.Client.Online.CSOM/15.0.4919.1000": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-kwIePwIWVPOMwqoKco4if9ShzljUMFNVnAwqUw0uwCinIfinwLGuqoQIOWhKdnNdRBsTgaRkng7W8KLKFl/7/w==",
|
||||
"path": "microsoft.sharepoint.client.online.csom/15.0.4919.1000",
|
||||
"hashPath": "microsoft.sharepoint.client.online.csom.15.0.4919.1000.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.SharePointOnline.CSOM/16.1.22615.12000": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
@@ -2346,6 +2900,13 @@
|
||||
"path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.2",
|
||||
"hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512"
|
||||
},
|
||||
"SharePoint.Client.Office.Tools/15.0.4907.1000": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-hqCDW9ObVOG+UTlLejHOiU3u/qA+gLI5egKHIPEvvinfwlyWy5NupqHCQne1WRFaZVxFGoW1QxkXh23mQ5KEXg==",
|
||||
"path": "sharepoint.client.office.tools/15.0.4907.1000",
|
||||
"hashPath": "sharepoint.client.office.tools.15.0.4907.1000.nupkg.sha512"
|
||||
},
|
||||
"SharePointPnP.IdentityModel.Extensions/1.2.4": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
@@ -2416,6 +2977,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,
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net6.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "6.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.PowerPlatform.Dataverse.Client" Version="1.0.39" />
|
||||
<PackageReference Include="Microsoft.SharePointOnline.CSOM" Version="16.1.23508.12000" />
|
||||
<PackageReference Include="PnP.Core" Version="1.9.0" />
|
||||
<PackageReference Include="PnP.Core.Admin" Version="1.9.0" />
|
||||
<PackageReference Include="PnP.Core.Auth" Version="1.9.0" />
|
||||
<PackageReference Include="PnP.Framework" Version="1.12.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.30.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user