문제

SharePoint Designer의 워크 플로우 편집기에서는 작업 흐름 개시 기의 사용자 이름/이름을 검색하고 싶습니다 (즉, 워크 플로우를 시작하거나 트리거 한 사람) - Nintex Workflow 2007과 같은 타사 제품을 사용하는 것은 비교적 쉽습니다 (내가 사용하는 곳. {Common : Initiator}와 같은 것 - 그러나 Share Point Designer 및 Moss 2007을 사용하여이를 수행 할 방법을 찾을 수는 없습니다.

업데이트

이 명백한 기능이 OOTB가 지원되는 것처럼 보이지 않으므로 결국 사용자 정의 활동을 작성했습니다 (답 중 하나가 제안한대로). 나는 매우 사소한 솔루션이기 때문에 블로그 에이 주변에 떠 다니는 몇 가지 사례가있을 것 같지만 아마도 참조를 위해 활동 코드를 여기에 나열했습니다.

public partial class LookupInitiatorInfo : Activity
{
    public static DependencyProperty __ActivationPropertiesProperty =
        DependencyProperty.Register("__ActivationProperties",
        typeof(Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties),
        typeof(LookupInitiatorInfo));

    public static DependencyProperty __ContextProperty =
        DependencyProperty.Register("__Context", typeof (WorkflowContext),
        typeof (LookupInitiatorInfo));

    public static DependencyProperty PropertyValueVariableProperty =
        DependencyProperty.Register("PropertyValueVariable", typeof (string),    
        typeof(LookupInitiatorInfo));

    public static DependencyProperty UserPropertyProperty = 
        DependencyProperty.Register("UserProperty", typeof (string),
        typeof (LookupInitiatorInfo));

    public LookupInitiatorInfo()
    {
        InitializeComponent();
    }

    [Description("ActivationProperties")]
    [ValidationOption(ValidationOption.Required)]
    [Browsable(true)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
    public Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties __ActivationProperties
    {
        get { return ((Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties)(base.GetValue(__ActivationPropertiesProperty))); }
        set { base.SetValue(__ActivationPropertiesProperty, value); }
    }

    [Description("Context")]
    [ValidationOption(ValidationOption.Required)]
    [Browsable(true)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
    public WorkflowContext __Context
    {
        get { return ((WorkflowContext)(base.GetValue(__ContextProperty))); }
        set { base.SetValue(__ContextProperty, value); }
    }

    [Description("UserProperty")]
    [ValidationOption(ValidationOption.Required)]
    [Browsable(true)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
    public string UserProperty
    {
        get { return ((string) (base.GetValue(UserPropertyProperty))); }
        set { base.SetValue(UserPropertyProperty, value); }
    }

    [Description("PropertyValueVariable")]
    [ValidationOption(ValidationOption.Required)]
    [Browsable(true)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
    public string PropertyValueVariable
    {
        get { return ((string) (base.GetValue(PropertyValueVariableProperty))); }
        set { base.SetValue(PropertyValueVariableProperty, value); }
    }

    protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
    {
        // value values for the UserProperty (in most cases you
        // would use LoginName or Name)

        //Sid
        //ID
        //LoginName
        //Name
        //IsDomainGroup
        //Email
        //RawSid
        //Notes

        try
        {
            string err = string.Empty;

            if (__ActivationProperties == null)
            {
                err = "__ActivationProperties was null";
            }
            else
            {
                SPUser user = __ActivationProperties.OriginatorUser;

                if (user != null && UserProperty != null)
                {
                    PropertyInfo property = typeof (SPUser).GetProperty(UserProperty);
                    if (property != null)
                    {
                        object value = property.GetValue(user, null);
                        PropertyValueVariable = (value != null) ? value.ToString() : "";
                    }
                    else
                    {
                        err = string.Format("no property found with the name \"{0}\"", UserProperty);
                    }
                }
                else
                {
                    err = "__ActivationProperties.OriginatorUser was null";
                }
            }
            if (!string.IsNullOrEmpty(err))
                Common.LogExceptionToWorkflowHistory(new ArgumentOutOfRangeException(err), executionContext,
                                                     WorkflowInstanceId);
        }
        catch (Exception e)
        {
            Common.LogExceptionToWorkflowHistory(e, executionContext, WorkflowInstanceId);
        }

        return ActivityExecutionStatus.Closed;
    }
}

그런 다음 다음 .Action XML 파일로 연결하십시오.

<?xml version="1.0" encoding="utf-8"?>
<WorkflowInfo Language="en-us">
<Actions>
    <Action Name="Lookup initiator user property"
 ClassName="XXX.ActivityLibrary.LookupInitiatorInfo"
 Assembly="XXX.ActivityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXX"
 AppliesTo="all"
 Category="WormaldWorkflow Custom Actions">
        <RuleDesigner Sentence="Lookup initating users property named %1 and store in %2">
            <FieldBind Field="UserProperty" DesignerType="TextArea" Id="1" Text="LoginName" />              
            <FieldBind Field="PropertyValueVariable" DesignerType="ParameterNames" Text="variable" Id="2"/>
        </RuleDesigner>
        <Parameters>
            <Parameter Name="__Context" Type="Microsoft.Sharepoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In"/>
            <Parameter Name="__ActivationProperties" Type="Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties, Microsoft.SharePoint" Direction="In"/>
            <Parameter Name="UserProperty" Type="System.String, mscorlib" Direction="In" />
            <Parameter Name="PropertyValueVariable" Type="System.String, mscorlib" Direction="Out" />
        </Parameters>
    </Action>
</Actions>
</WorkflowInfo>
도움이 되었습니까?

해결책

나는 이것이 SharePoint 디자이너에서 할 수 있다고 생각하지 않습니다. 당신은 아마도 창시자를 얻기 위해 사용자 정의 조치를 작성할 수 있지만 SPD 워크 플로 인터페이스를 통해 노출 된 것은 아니라고 생각합니다.

아마도 당신이 할 수있는 최선은 목록에서 항목을 생성하거나 수정 한 사용자를 얻는 것입니다. 그러나 워크 플로가 수동으로 실행되는 경우를 처리하지 않습니다.

다른 팁

For those that google into this article and are now using SharePoint 2010, the workflow initiator variable is now supported OOTB in SharePoint Designer.

The datasource would be "Workflow Context" and the field is, of course, "Initiator" and you can choose to return it as the "Display Name", "Email", "Login Name" or the "User ID Number"

I can think about a simple but not very sophisticated solution for this one by using just SPD. Just in workflow steps create a test item in a secondary list (probably a task list which stores the workflowId and itemId properties for refrence back) and then do a lookup in your workflow on that list to see who is the creator of that item, that value would be the current workflow initiator.

The custom activity solution only work if you are working with moss, if you only have wss 3.0 you can put one step more in your workflow and set a custom comment field with any information, this make the last modified person to change and become the same as the workflow initiator, then you can use the ModifiedBy field to make any decision that you need.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top