Visual Studio sample code
Here is the orchestration as a single C# file in a Visual Studio project:
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
namespace VSSample
{
public static class HelloSequence
{
[]
public static async Task<List<string>> Run(
[] DurableOrchestrationContextBase context)
{
var outputs = new List<string>();
outputs.Add(await context.CallActivityAsync<string>("E1_GetSiteTitle", SiteUrl));
return outputs;
}
[]
public static string GetSiteTitle([ActivityTrigger] DurableActivityContextBase context)
{
string siteDescription = "this is
communication site for test purpose";
string Password = "Mylan@123";
string communityUrl = string.Empty;
SecureString securePwd = new SecureString();
foreach (char c in Password)
{
securePwd.AppendChar(c);
}
securePwd.MakeReadOnly();
/* Create
Site using CreateSiteAsync method */
using (var ctx = new
ClientContext(siteUrl))
{
//
ctx.Credentials = new NetworkCredentials(userName, pwd);
ctx.Credentials = new SharePointOnlineCredentials(UName, securePwd);
ctx.RequestTimeout = Timeout.Infinite;
// Just
to output the site details
Web web = ctx.Web;
ctx.Load(web, w => w.Title);
ctx.ExecuteQuery();
communityUrl = "Web Title is :" + web.Title;
}
return $"Hello {communityUrl}!";
}
}
}
No comments:
Post a Comment