简体   繁体   English

在SharePoint 2013工作流期间使用自定义类型的变量

[英]Using Custom Types for Variables during SharePoint 2013 Workflows

I want to define a simple object from a class with only one property as a variable in sharepoint 2013 workflow. 我想从一个类中定义一个简单的对象,在sharepoint 2013工作流中只有一个属性作为变量。

The Class code is: 类代码是:

 public class RssFeedItem
{
    public string Title { get; set; }
}

I can create a variable with this type in workflow as you can see at the following image: 我可以在工作流中创建具有此类型的变量,如下图所示:

在此输入图像描述

After that i add an Assign Activity, and set FeedTitle=MyFeed.Title: 之后我添加一个Assign Activity,并设置FeedTitle = MyFeed.Title:

在此输入图像描述

But when i built workflow i get the following error: 但是当我构建工作流时,我收到以下错误:

在此输入图像描述

Error message is: Failed to translate expression 'MyFeed.Title' because of the following error: Property access conversion to an activity is not supported for property 'Title' defined on type 'FeedReaderLib.RssFeedItem'. 错误消息是: 由于以下错误,无法翻译表达式“MyFeed.Title”:对于“FeedReaderLib.RssFeedItem”类型上定义的属性“Title”,不支持对活动进行属性访问转换。

Could anyone help me to solve this problem? 任何人都可以帮我解决这个问题吗?

Any help would be appreciated. 任何帮助,将不胜感激。

It seems that you have not added the RssFeedItem to the AllowedTypes.xml check if your .dll file for FeedReaderLib and AllowedTypes.xml are placed inside those folders: 如果您的FeedReaderLibAllowedTypes.xml的 .dll文件放在这些文件夹中,您似乎还没有将RssFeedItem添加到AllowedTypes.xml检查中:

C:\Program Files\Workflow Manager\1.0\Workflow\Artifacts
C:\Program Files\Workflow Manager\1.0\Workflow\WFWebRoot\bin

You can find more details on AllowedTypes.xml structure here: Defining and using custom code activities and types in a Workflow Manager 您可以在此处找到有关AllowedTypes.xml结构的更多详细信息: 在Workflow Manager中定义和使用自定义代码活动和类型

But as the article says : 但正如文章所说:

Extending the set of allowed types and activities has potentially a huge impact on the security, performance, scalability and availability of Workflow Manager 1.0 and should not be considered unless absolutely necessary, for example, when workflows need to perform sophisticated calculations or data transformation that would be impractical to author in an declarative activity. 扩展允许的类型和活动集可能会对Workflow Manager 1.0的安全性,性能,可伸缩性和可用性产生巨大影响,除非绝对必要,否则不应考虑,例如,当工作流需要执行复杂的计算或数据转换时在声明性活动中作者是不切实际的。 In this case, advanced users may want to use a custom code activity instead. 在这种情况下,高级用户可能希望使用自定义代码活动。 The server administrator can extend the set of allowed types to include this code activity, providing that the administrator fully trust this code activity. 服务器管理员可以扩展允许类型集以包括此代码活动,前提是管理员完全信任此代码活动。

Maybe it is worth giving a try using the DynamicValue type? 也许值得尝试使用DynamicValue类型?

I solve my problem. 我解决了我的问题。

I just need to update SharePoint 2013 to Service Pack 1, and then Rerun SP-Register workflow service on SharePoint. 我只需要将SharePoint 2013更新到Service Pack 1,然后在SharePoint上重新运行SP-Register工作流服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM