SharePointOnlineCredentials 的 WWF 自定义 Activity 绑定

WWF Custom Activity binding for SharePointOnlineCredentials

我创建了一组 WWF 自定义活动以通过 CSOM 与 SharePoint 交互。我已经创建了下面的 Activity,但是,我正在努力在 XAML Designer 中绑定参数,我已经在 XAML 文件中导入了 Microsoft.SharePoint.Client 命名空间,但是我当我尝试将 ExpressionType 绑定到 sp:SharePointOnlineCredentials.

时出现以下错误 (The name "SharePointOnlineCredentials" does not exist in the namespace "clr-namespace:Microsoft.SharePoint.Client")

谁能告诉我如何将 ExpressionTextBox ExpressionType 绑定为 SharePointOnlineCredentials

注意:我发现部分代码缺失,这是故意的!

Activity Class

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>

此问题是由于缺少程序集引用引起的。

如果您查看 MSDN 上的 class 详细信息,命名空间是 Microsoft.SharePoint.Client,程序集是 Microsoft.SharePoint.Client.Runtime

通过将 xmlns:sp="clr-namespace:Microsoft.SharePoint.Client" 更改为 xmlns:sp="clr-namespace:Microsoft.SharePoint.Client;assembly=Microsoft.SharePoint.Client.Runtime" 问题已解决。