Minor Update
This commit is contained in:
@@ -23,31 +23,6 @@ namespace SharePointOnlineUtils
|
||||
SecureString svcUserPsw = new NetworkCredential("", "$O,D1XBp1O5.OdjZt86#a=").SecurePassword;
|
||||
|
||||
ProjectsByYearSite(siteCollection, svcUser, svcUserPsw);
|
||||
|
||||
#region test
|
||||
// Note: The PnP Sites Core AuthenticationManager class also supports this
|
||||
/*Uri site = new Uri(siteCollection);
|
||||
using (var authenticationManager = new AuthenticationManager())
|
||||
using (var ctx = authenticationManager.GetContext(site, svcUser, svcUserPsw))
|
||||
{
|
||||
Web web = ctx.Web;
|
||||
|
||||
//web.Description = "";
|
||||
//web.Update();
|
||||
|
||||
ctx.Load(web,
|
||||
w => w.Title,
|
||||
w => w.Description,
|
||||
w => w.SiteGroups
|
||||
);
|
||||
|
||||
await ctx.ExecuteQueryAsync();
|
||||
|
||||
Console.WriteLine($"Web: {web.Title}");
|
||||
Console.WriteLine($"Description: {web.Description}");
|
||||
Console.WriteLine($"Group: {web.SiteGroups}");
|
||||
}*/
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static async Task ProjectsByYearSite(string siteCollection, string user, SecureString psw)
|
||||
@@ -59,20 +34,20 @@ namespace SharePointOnlineUtils
|
||||
using (var authenticationManager = new AuthenticationManager())
|
||||
using (var ctx = authenticationManager.GetContext(site, user, psw))
|
||||
{
|
||||
if (SPCheck.SiteExist(ctx) != false)
|
||||
if (SharePointCustomOperation.SiteExist(ctx) != false)
|
||||
{
|
||||
Console.WriteLine($"{projectsYear} - Esiste già.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"{projectsYear} - Non esiste, a breve verrà generata.");
|
||||
SPCheck.ProjectsYearGenerator(year, site, user, psw);
|
||||
SharePointCustomOperation.ProjectsYearGenerator(year, site, user, psw);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SPCheck
|
||||
public class SharePointCustomOperation
|
||||
{
|
||||
public static bool SiteExist(ClientContext ctx)
|
||||
{
|
||||
@@ -109,6 +84,7 @@ namespace SharePointOnlineUtils
|
||||
scp.Template = "SITEPAGEPUBLISHING#0";
|
||||
|
||||
SpoOperation spo = tenant.CreateSite(scp);
|
||||
|
||||
ctx.Load(tenant);
|
||||
ctx.Load(spo, i => i.IsComplete);
|
||||
ctx.ExecuteQuery();
|
||||
@@ -129,6 +105,8 @@ namespace SharePointOnlineUtils
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class AuthenticationManager : IDisposable
|
||||
|
||||
Reference in New Issue
Block a user