【发布时间】:2018-11-06 23:12:40
【问题描述】:
我创建了一组 WWF 自定义活动以通过 CSOM 与 SharePoint 交互。我已经创建了以下活动,但是,我正在努力绑定 XAML 设计器中的参数,我已经在 XAML 文件中导入了 Microsoft.SharePoint.Client 命名空间,但是当我尝试绑定时出现以下错误 (The name "SharePointOnlineCredentials" does not exist in the namespace "clr-namespace:Microsoft.SharePoint.Client")表达式类型为sp:SharePointOnlineCredentials。
谁能建议我如何将ExpressionTextBox ExpressionType 绑定为SharePointOnlineCredentials?
注意:我意识到缺少一些代码,这是故意的!
活动类
using Microsoft.SharePoint.Client;
using System.Activities;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
namespace Custom_Activities.SharePoint
{
public sealed class List_To_DataTable : CodeActivity
{
[Category("Input")]
[DisplayName("SharePoint Credentials")]
public InArgument<SharePointOnlineCredentials> SharePoint_Credentials { get; }
protected override void Execute(CodeActivityContext context)
{
DataTable table = new DataTable();
//Gets content
Dt.Set(context,table);
}
}
}
XAML 设计
<sap:ActivityDesigner
x:Class="CS_Activities.SharePoint.Design.List_To_DataTable_Designer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:sp="clr-namespace:Microsoft.SharePoint.Client">
<sap:ActivityDesigner.Resources>
<ResourceDictionary x:Uid="ResourceDictionary_1">
<sapc:ArgumentToExpressionConverter x:Key="ArgumentToExpressionConverter" />
<sapc:ModelToObjectValueConverter x:Key="ModelToObjectValueConverter" />
<DataTemplate x:Key="Collapsed">
<TextBlock VerticalAlignment = "Center" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="0" Margin="5" Text="List Name" />
<sapv:ExpressionTextBox HintText = "Enter you Sharepoint Credentials" Expression="{Binding Path=ModelItem.SharePoint_Credentials, Mode=TwoWay, Converter={StaticResource ArgumentToExpressionConverter}, ConverterParameter=In }" ExpressionType="sp:SharePointOnlineCredentials" Grid.Row="0" Grid.Column="1" OwnerActivity="{Binding Path=ModelItem}" Width="300" Margin="0,5" MaxLines="1" />
</DataTemplate>
【问题讨论】:
标签: c# xaml csom custom-activity