0

我创建了一组 WWF 自定义活动以通过 CSOM 与 SharePoint 交互。我创建了以下活动,但是,我在 XAML 设计器中绑定参数时遇到了困难,我已经Microsoft.SharePoint.Client在 XAML 文件中导入了命名空间,但是The name "SharePointOnlineCredentials" does not exist in the namespace "clr-namespace:Microsoft.SharePoint.Client"当我尝试将 ExpressionType 绑定到sp:SharePointOnlineCredentials.

任何人都可以建议我如何绑定ExpressionTextBox ExpressionTypetoSharePointOnlineCredentials吗?

注意:我意识到缺少一些代码,这是故意的!

活动课

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>
4

1 回答 1

0

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

如果您查看MSDN上的课程详细信息,则命名空间是Microsoft.SharePoint.Client,而 assemvly 是Microsoft.SharePoint.Client.Runtime

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

于 2018-11-07T10:18:51.693 回答