update directory name and access visibility

This commit is contained in:
Kalarumeth
2022-09-29 08:33:32 +02:00
parent 3ab3afe25e
commit f258a284d6
86 changed files with 253 additions and 361 deletions
@@ -0,0 +1,40 @@
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.WebParts;
namespace console_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");
}
}
}
}