update directory name and access visibility
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using console_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace console_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 ILogger<QuotationBuildService> logger;
|
||||
|
||||
public QuotationBuildService(
|
||||
ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ISharePointCustomOperation spc,
|
||||
ITenantService tenantService,
|
||||
IQuotationDocLibraryService quotationDocLibraryService,
|
||||
IQuotationDocSetService quotationDocSetService,
|
||||
ILogger<QuotationBuildService> logger)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
this.sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
this.spc = spc;
|
||||
this.tenantService = tenantService;
|
||||
this.quotationDocLibraryService = quotationDocLibraryService;
|
||||
this.quotationDocSetService = quotationDocSetService;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public void CreateIfNotExists(string quotationName)
|
||||
{
|
||||
var site = siteOptions.GetQuotationSite();
|
||||
var ctx = sharePointAuthenticationManager.GetContext(site);
|
||||
var list = siteOptions.GetQuotationLibrary();
|
||||
var tenant = siteOptions.GetQuotationTenant();
|
||||
|
||||
if (!spc.SiteExist(ctx))
|
||||
{
|
||||
tenantService.CreateForQuotation();
|
||||
}
|
||||
else if (!spc.ListExist(ctx, list))
|
||||
{
|
||||
quotationDocLibraryService.Create(list, ctx);
|
||||
}
|
||||
else if (!spc.FolderExistsInsideList(ctx, list, quotationName))
|
||||
{
|
||||
quotationDocSetService.Create(quotationName, list, tenant, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation($"Quotation with {quotationName} already exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user