Hi there,
Has anybody ever written code to return the GUID of a folder in SharePoint Workflow Activity so I can then pass it into a Workflow Variable?
Would be really keen to see a code sample if you have one!
Thanks
Hi there,
Has anybody ever written code to return the GUID of a folder in SharePoint Workflow Activity so I can then pass it into a Workflow Variable?
Would be really keen to see a code sample if you have one!
Thanks
I've done something similar, and I can offer a few tips. I didn't find code samples, so I copied code from SharePoint's DLLs using Reflector.
File: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\microsoft.sharepoint.WorkflowActions.dll Class (for example): Microsoft.SharePoint.WorkflowActions.WaitForActivity
You'll find three properties and DependencyProperty
s:
[Browsable(true), ValidationOption(ValidationOption.Required), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public WorkflowContext __Context
{
get { return (WorkflowContext)base.GetValue(__ContextProperty); }
set { base.SetValue(__ContextProperty, value); }
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Browsable(true), ValidationOption(ValidationOption.Required)]
public string __ListId
{
get { return (string)base.GetValue(__ListIdProperty); }
set { base.SetValue(__ListIdProperty, value); }
}
[Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), ValidationOption(ValidationOption.Required)]
public int __ListItem
{
get { return (int)base.GetValue(__ListItemProperty); }
set { base.SetValue(__ListItemProperty, value); }
}
public static DependencyProperty __ContextProperty;
public static DependencyProperty __ListIdProperty;
public static DependencyProperty __ListItemProperty;
And this in a static constructor:
static MyActivity()
{
__ContextProperty = DependencyProperty.Register("__Context", typeof(WorkflowContext), typeof(MyActivity));
__ListIdProperty = DependencyProperty.Register("__ListId", typeof(string), typeof(MyActivity));
__ListItemProperty = DependencyProperty.Register("__ListItem", typeof(int), typeof(MyActivity));
}
Bind them on your actions
file:
<Parameters>
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In"/>
<Parameter Name="__ListId" Type="System.String, mscorlib, mscorlib" Direction="In" />
<Parameter Name="__ListItem" Type="System.Int32, mscorlib, mscorlib" Direction="In" />
</Parameters>
This can be copied from the file
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\Workflow\WSS.ACTIONS
Then, it sould be relatively easy to get the GUID, and return it using a property and out parameter binding.