update directory name and access visibility
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user