上下文 . ExecuteQuery ();在SPO UI中,该功能显示为已激活,但在列表的工作流设置中仍未找到任何批准工作流模板激活工作流程";功能未在此处的设置中反映出模板.我错过了两者之间的一步吗?此致 Palak Jain 解决方案请使用PnP-Core CSOM库通过GUID激活该功能,SharePoint 2010批准工作流将如期出现,这是一个演示供您参考:静态void Main(string [] args) { 字符串siteUrl ="https://microsoft.sharepoint.com/teams/Jerrytest/"; 字符串userName ="[email protected]"; 字符串密码="********"; 尝试 { 使用(ClientContext clientContext = new ClientContext(siteUrl)) { SecureString passWord = new SecureString(); foreach(password.ToCharArray()中的char c)passWord.AppendChar(c); clientContext.Credentials =新的SharePointOnlineCredentials(userName,passWord); Web web = clientContext.Web; clientContext.Load(web); clientContext.ExecuteQuery(); clientContext.Load(web.Features); clientContext.ExecuteQuery(); Console.WriteLine(web.Title); 引导特征Id =新引导("0af5989a-3aea-4519-8ab0-85d91abe39ff"); clientContext.Site.ActivateFeature(featureId); clientContext.ExecuteQuery(); Console.WriteLine(功能明确"); Console.ReadKey(); } } 抓住(前例外) { Console.WriteLine(错误激活功能"); Console.WriteLine("错误消息:" + ex.Message); Console.ReadKey(); } } 通过在Visual Studio中搜索OfficeDevPnP,添加带有Nuget包的PnP核心库:结果:更多详细信息,请参阅: 工作使用PnP Core CSOM库的SharePoint Online网站范围功能谢谢最好的问候 Hi,I am trying to activate "Approval Workflows" in SharePoint online using below code.var featureId =new Guid("0af5989a-3aea-4519-8ab0-85d91abe39ff");var features= context.Site.Features;features.Add(featureId,true,FeatureDefinitionScope.None);context.ExecuteQuery();In SPO UI, feature shown as activated but still not found any Approval workflow templates in Workflow settings of a list Activating "Workflows" feature not reflected templates here in settings. Have I missed a step in between?Regards,Palak Jain 解决方案 Hi,Please use PnP-Core CSOM library to active the feature with GUID and the SharePoint 2010 approval workflow will appear as expected, Here is a demo for your reference: static void Main(string[] args) { string siteUrl = "https://microsoft.sharepoint.com/teams/Jerrytest/"; string userName = "[email protected]"; string password = "******"; try { using (ClientContext clientContext = new ClientContext(siteUrl)) { SecureString passWord = new SecureString(); foreach (char c in password.ToCharArray()) passWord.AppendChar(c); clientContext.Credentials = new SharePointOnlineCredentials(userName, passWord); Web web = clientContext.Web; clientContext.Load(web); clientContext.ExecuteQuery(); clientContext.Load(web.Features); clientContext.ExecuteQuery(); Console.WriteLine(web.Title); Guid featureId = new Guid("0af5989a-3aea-4519-8ab0-85d91abe39ff"); clientContext.Site.ActivateFeature(featureId); clientContext.ExecuteQuery(); Console.WriteLine("Feature is acticated"); Console.ReadKey(); } } catch (Exception ex) { Console.WriteLine("Error activating feature"); Console.WriteLine("Error Message: " + ex.Message); Console.ReadKey(); } }Add PnP Core library with Nuget Package by search OfficeDevPnP in Visual Studio:Result:More detailed information, please refer:Working With SharePoint Online Site Scoped Features Using PnP Core CSOM LibraryThanksBest Regards 这篇关于激活“批准工作流".使用CSOM C#在Sharepoint在线中进行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-14 06:45