Home
%3CLINGO-SUB%20id%3D%22lingo-sub-974397%22%20slang%3D%22en-US%22%3ECreating%20a%20Workflow%20Activity%20Library%20and%20Activity%20Part%203%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-974397%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20May%2017%2C%202016%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20This%20post%20is%20in%20continuation%20of%20the%20Post%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fconnector_space%2F2016%2F05%2F12%2Fcreating-a-workflow-activity-library-and-activity-part-2%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Creating%20a%20Workflow%20Activity%20Library%20and%20Activity%20Part%202%20%3C%2FA%3E%20This%20post%20will%20focus%20on%20Defining%20properties%20for%20your%20custom%20activity.%20%3CBR%20%2F%3E%20Now%2C%20you%20can%20define%20properties%20that%20will%20store%20the%20log%20file%20path%20and%20log%20file%20name%20where%20the%20activity%20will%20log%20information%20about%20the%20current%20request%20and%20workflow%20dictionary%20information.%20%3CBR%20%2F%3E%20The%20following%20table%20describes%20the%20three%20properties%20that%20you%20add%20for%20the%20RequestLoggingActivity.%20%3CBR%20%2F%3E%3CTABLE%3E%3CBR%20%2F%3E%3CTBODY%3E%3CBR%20%2F%3E%3CTR%3E%3CBR%20%2F%3E%3CTH%3EProperty%20name%3C%2FTH%3E%3CBR%20%2F%3E%3CTH%3EDescription%3C%2FTH%3E%3CBR%20%2F%3E%3C%2FTR%3E%3CBR%20%2F%3E%3CTR%3E%3CBR%20%2F%3E%3CTD%3ELogFilePath%3C%2FTD%3E%3CBR%20%2F%3E%3CTD%3EThis%20property%20is%20an%20input%20property%20indicating%20the%20folder%20where%20the%20log%20file%20should%20be%20saved.%3C%2FTD%3E%3CBR%20%2F%3E%3C%2FTR%3E%3CBR%20%2F%3E%3CTR%3E%3CBR%20%2F%3E%3CTD%3ELogFileName%3C%2FTD%3E%3CBR%20%2F%3E%3CTD%3EThis%20property%20is%20an%20input%20property%20indicating%20the%20log%20file%20name.%3C%2FTD%3E%3CBR%20%2F%3E%3C%2FTR%3E%3CBR%20%2F%3E%3CTR%3E%3CBR%20%2F%3E%3CTD%3ECurrentRequest%3C%2FTD%3E%3CBR%20%2F%3E%3CTD%3EThis%20property%20is%20used%20to%20store%20information%20about%20the%20current%20request.%3C%2FTD%3E%3CBR%20%2F%3E%3C%2FTR%3E%3CBR%20%2F%3E%3C%2FTBODY%3E%3CBR%20%2F%3E%3C%2FTABLE%3E%3CBR%20%2F%3E%20The%20input%20properties%20will%20be%20displayed%20in%20the%20%3CSTRONG%3E%20Workflow%20Designer%20%3C%2FSTRONG%3E%20in%20the%20FIM%20Portal%20when%20the%20activity%20is%20added%20to%20a%20workflow.%20The%20user%20that%20adds%20the%20activity%20to%20the%20workflow%20must%20enter%20values%20for%20these%20properties.%20%3CBR%20%2F%3E%3CH4%20class%3D%22subHeading%22%20id%3D%22toc-hId-1458697721%22%20id%3D%22toc-hId-1460483390%22%3ETo%20define%20properties%20for%20the%20RequestLoggingActivity%3C%2FH4%3E%3CBR%20%2F%3E%20(Locate%20the%20Solution%20Explorer%2C%20if%20for%20some%20reason%20it%20was%20closed%20you%20can%20always%20reopen%20it%20in%20from%20the%20View%20Menu)%20%3CBR%20%2F%3E%20Right-click%20%3CSTRONG%3E%20RequestLoggingActivity.cs%20%3C%2FSTRONG%3E%20in%20%3CSTRONG%3E%20Solution%20Explorer%20%3C%2FSTRONG%3E%20%2C%20and%20then%20click%20%3CSTRONG%3E%20View%20Code%20%3C%2FSTRONG%3E%20.%20%3CBR%20%2F%3E%3CIMG%20alt%3D%22ViewCode%22%20class%3D%22alignnone%20size-mediumlarge%20wp-image-2255%22%20height%3D%22350%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F153714iD4B72BCB4442EFAA%22%20width%3D%22232%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20should%20now%20see%20the%20code%20as%20it%20is%20represented%20so%20far.%20%3CBR%20%2F%3E%3CIMG%20alt%3D%22StartCode%22%20class%3D%22alignnone%20size-mediumlarge%20wp-image-2265%22%20height%3D%22241%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F153716i17B020D8C4F41AB6%22%20width%3D%22500%22%20%2F%3E%3CBR%20%2F%3EAdd%20the%20following%20%3CSTRONG%3E%20using%20%3C%2FSTRONG%3E%20statements%20to%20the%20top%20of%20the%20file%3A%20%3CBR%20%2F%3E%3CDIV%20class%3D%22codeSnippetContainer%22%20id%3D%22code-snippet-1%22%3E%3CBR%20%2F%3E%3CDIV%20class%3D%22codeSnippetContainerCodeContainer%22%3E%3CBR%20%2F%3E%3CDIV%20class%3D%22codeSnippetContainerCode%22%20dir%3D%22ltr%22%20id%3D%22CodeSnippetContainerCode_0fb7e4bf-6b8a-4090-866f-40037de39c80%22%3E%3CBR%20%2F%3E%3CDIV%3E%3CBR%20%2F%3E%3CPRE%3Eusing%20System.Collections.Generic%3B%3CBR%20%2F%3Eusing%20System.Collections.ObjectModel%3B%3CBR%20%2F%3Eusing%20System.IO%3B%3CBR%20%2F%3E%2F%2FThe%20following%20two%20namespaces%20define%20the%20FIM%20object%20model%3CBR%20%2F%3Eusing%20Microsoft.ResourceManagement.WebServices.WSResourceManagement%3B%3CBR%20%2F%3Eusing%20Microsoft.ResourceManagement.Workflow.Activities%3B%3CBR%20%2F%3E%3C%2FPRE%3E%0A%20%20%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%3C%2FDIV%3E%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%3C%2FDIV%3E%0A%20%20%3CBR%20%2F%3E%0A%20%20The%20code%20should%20now%20look%20something%20like%0A%20%20%3CBR%20%2F%3E%0A%20%20%3CIMG%20alt%3D%22UpdatedCode%22%20class%3D%22alignnone%20size-mediumlarge%20wp-image-2275%22%20height%3D%22268%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F153717i06FA76FB6F41C1B8%22%20width%3D%22500%22%20%2F%3E%0A%20%20%3CBR%20%2F%3E%0A%20%20Add%20the%20following%20code%20to%20RequestLoggingActivity.cs%20after%20the%20class%20constructor%3A%0A%20%20%3CBR%20%2F%3E%0A%20%20%3CDIV%20class%3D%22codeSnippetContainer%22%20id%3D%22code-snippet-2%22%3E%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20%3CDIV%20class%3D%22codeSnippetContainerCodeContainer%22%3E%0A%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%20%3CDIV%20class%3D%22codeSnippetContainerCode%22%20dir%3D%22ltr%22%20id%3D%22CodeSnippetContainerCode_91eb42eb-22a1-4c43-85b8-9e41fae59788%22%3E%0A%20%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%20%20%3CDIV%3E%0A%20%20%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%20%20%20%3CPRE%3E%23region%20Public%20Workflow%20Properties%3CBR%20%2F%3Epublic%20static%20DependencyProperty%20ReadCurrentRequestActivity_CurrentRequestProperty%20%3D%20DependencyProperty.Register(%22ReadCurrentRequestActivity_CurrentRequest%22%2C%20typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType)%2C%20typeof(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity))%3B%3CBR%20%2F%3E%2F%2F%2F%20%3CSUMMARY%3E%3CBR%20%2F%3E%2F%2F%2F%20%20Stores%20information%20about%20the%20current%20request%3CBR%20%2F%3E%2F%2F%2F%20%3C%2FSUMMARY%3E%3CBR%20%2F%3E%5BDesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)%5D%3CBR%20%2F%3E%5BBrowsableAttribute(true)%5D%3CBR%20%2F%3E%5BCategoryAttribute(%22Misc%22)%5D%3CBR%20%2F%3Epublic%20RequestType%20ReadCurrentRequestActivity_CurrentRequest%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%20%20%20%20%20get%3CBR%20%2F%3E%20%20%20%20%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%20return%20((Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType)%20(base.GetValue(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity.ReadCurrentRequestActivity_CurrentRequestProperty)))%3B%3CBR%20%2F%3E%20%20%20%20%20%7D%3CBR%20%2F%3E%20%20%20%20%20set%3CBR%20%2F%3E%20%20%20%20%20%7B%20%20%20%20%20%20%20%20base.SetValue(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity.ReadCurrentRequestActivity_CurrentRequestProperty%2C%20value)%3B%3CBR%20%2F%3E%20%20%20%20%20%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%2F%2F%2F%20%3CSUMMARY%3E%3CBR%20%2F%3E%2F%2F%2F%20%20Identifies%20the%20Log%20File%20Path%3CBR%20%2F%3E%2F%2F%2F%20%3C%2FSUMMARY%3E%3CBR%20%2F%3Epublic%20static%20DependencyProperty%20LogFilePathProperty%20%3D%20DependencyProperty.Register(%22LogFilePath%22%2C%20typeof(System.String)%2C%20typeof(RequestLoggingActivity))%3B%3CBR%20%2F%3E%5BDescription(%22Please%20specify%20the%20Log%20File%20Path%22)%5D%3CBR%20%2F%3E%5BDesignerSerializationVisibility(DesignerSerializationVisibility.Visible)%5D%3CBR%20%2F%3E%5BBrowsable(true)%5D%3CBR%20%2F%3Epublic%20string%20LogFilePath%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%20%20%20%20get%3CBR%20%2F%3E%20%20%20%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20return%20((String)(base.GetValue(RequestLoggingActivity.LogFilePathProperty)))%3B%3CBR%20%2F%3E%20%20%20%20%7D%3CBR%20%2F%3E%20%20%20%20set%3CBR%20%2F%3E%20%20%20%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20base.SetValue(RequestLoggingActivity.LogFilePathProperty%2C%20value)%3B%3CBR%20%2F%3E%20%20%20%20%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%2F%2F%2F%20%3CSUMMARY%3E%3CBR%20%2F%3E%2F%2F%2F%20%20Identifies%20the%20Log%20File%20Name%3CBR%20%2F%3E%2F%2F%2F%20%3C%2FSUMMARY%3E%3CBR%20%2F%3Epublic%20static%20DependencyProperty%20LogFileNameProperty%20%3D%20DependencyProperty.Register(%22LogFileName%22%2C%20%3CBR%20%2F%3E%20%20%20%20%20typeof(System.String)%2C%20typeof(RequestLoggingActivity))%3B%3CBR%20%2F%3E%5BDescription(%22Please%20specify%20the%20Log%20File%20Path%22)%5D%3CBR%20%2F%3E%5BDesignerSerializationVisibility(DesignerSerializationVisibility.Visible)%5D%3CBR%20%2F%3E%5BBrowsable(true)%5D%3CBR%20%2F%3Epublic%20string%20LogFileName%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%20%20%20%20get%3CBR%20%2F%3E%20%20%20%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20return%20((String)(base.GetValue(RequestLoggingActivity.LogFileNameProperty)))%3B%3CBR%20%2F%3E%20%20%20%20%7D%3CBR%20%2F%3E%20%20%20%20set%3CBR%20%2F%3E%20%20%20%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20base.SetValue(RequestLoggingActivity.LogFileNameProperty%2C%20value)%3B%3CBR%20%2F%3E%20%20%20%20%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%23endregion%3CBR%20%2F%3EYou%20have%20now%20defined%20three%20properties%20that%20you%20can%20use%20in%20your%20custom%20activity.%3CBR%20%2F%3E%3C%2FPRE%3E%0A%20%20%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%3CBR%20%2F%3E%0A%20%20%20%3C%2FDIV%3E%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%3C%2FDIV%3E%0A%20%20%3CBR%20%2F%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-974397%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20May%2017%2C%202016%20This%20post%20is%20in%20continuation%20of%20the%20Post%20Creating%20a%20Workflow%20Activity%20Library%20and%20Activity%20Part%202%20This%20post%20will%20focus%20on%20Defining%20properties%20for%20your%20custom%20activity.%3C%2FLINGO-TEASER%3E
Microsoft
First published on MSDN on May 17, 2016
This post is in continuation of the Post Creating a Workflow Activity Library and Activity Part 2 This post will focus on Defining properties for your custom activity.
Now, you can define properties that will store the log file path and log file name where the activity will log information about the current request and workflow dictionary information.
The following table describes the three properties that you add for the RequestLoggingActivity.



















Property name Description
LogFilePath This property is an input property indicating the folder where the log file should be saved.
LogFileName This property is an input property indicating the log file name.
CurrentRequest This property is used to store information about the current request.

The input properties will be displayed in the Workflow Designer in the FIM Portal when the activity is added to a workflow. The user that adds the activity to the workflow must enter values for these properties.

To define properties for the RequestLoggingActivity


(Locate the Solution Explorer, if for some reason it was closed you can always reopen it in from the View Menu)
Right-click RequestLoggingActivity.cs in Solution Explorer , and then click View Code .
ViewCode


You should now see the code as it is represented so far.
StartCode
Add the following using statements to the top of the file:




using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
//The following two namespaces define the FIM object model
using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
using Microsoft.ResourceManagement.Workflow.Activities;





The code should now look something like
UpdatedCode
Add the following code to RequestLoggingActivity.cs after the class constructor:




#region Public Workflow Properties
public static DependencyProperty ReadCurrentRequestActivity_CurrentRequestProperty = DependencyProperty.Register("ReadCurrentRequestActivity_CurrentRequest", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType), typeof(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity));
/// <summary>
/// Stores information about the current request
/// </summary>
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Misc")]
public RequestType ReadCurrentRequestActivity_CurrentRequest
{
get
{
return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType) (base.GetValue(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity.ReadCurrentRequestActivity_CurrentRequestProperty)));
}
set
{ base.SetValue(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity.ReadCurrentRequestActivity_CurrentRequestProperty, value);
}
}
/// <summary>
/// Identifies the Log File Path
/// </summary>
public static DependencyProperty LogFilePathProperty = DependencyProperty.Register("LogFilePath", typeof(System.String), typeof(RequestLoggingActivity));
[Description("Please specify the Log File Path")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Browsable(true)]
public string LogFilePath
{
get
{
return ((String)(base.GetValue(RequestLoggingActivity.LogFilePathProperty)));
}
set
{
base.SetValue(RequestLoggingActivity.LogFilePathProperty, value);
}
}
/// <summary>
/// Identifies the Log File Name
/// </summary>
public static DependencyProperty LogFileNameProperty = DependencyProperty.Register("LogFileName",
typeof(System.String), typeof(RequestLoggingActivity));
[Description("Please specify the Log File Path")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Browsable(true)]
public string LogFileName
{
get
{
return ((String)(base.GetValue(RequestLoggingActivity.LogFileNameProperty)));
}
set
{
base.SetValue(RequestLoggingActivity.LogFileNameProperty, value);
}
}
#endregion
You have now defined three properties that you can use in your custom activity.