Home > CMS- Content Management System > Sharepoint > How to get Current Site URL in Visual Studio SharePoint workflow

How to get Current Site URL in Visual Studio SharePoint workflow

Using “LookupWorkflowContextProperty“, we can retrieve Current Site URL.

LookupWorkflowContextProperty retrieves a property from the workflow instance.

LookupWorkflowContextProperty which return following properties.

  1. Associator: SharePoint app pool account when you first created the web application. [SHAREPOINT\system]
  2. Initiator: Get the name of the workflow Initiator, It will return user name who initiate the workflow
  3. Association Name: “UserInfoWorkflow – ItemAdded”  It will return the Workflow start options [Start workflow Manually Mm Created and Updated].
  4. Instance ID: “WorkflowInstanceName” Workflow Instance id which can be seen in the Workflow Status URL [76bae674-7888-4f99-b812-9048bf8e84c9].
  5. Current Site URL: It will return the Current Site URL.
  6. Current Item URL: It will return the Current Item URL. 
  7. List Name: It will return List name which is associated with the workflow.
  8. List Id : It will return List Guid [ {2188AB02-E5CE-46C5-B580-C1279CE2CA62} ] which is associated with the workflow.

I used “LookupWorkflowContextProperty” activity in my workflow to get the value of the Current Site URL.

For Debugging purpose I am printing  Current Site URL value in WriteToHistry activity property by using the varCurrentSiteURL local variable.

The workflow is associated with UserInfoList.

WriteToHistroy

Here is the desired output of the Current Site URL which I printed using WriteToHistry.

CurrentSiteURL Output

Hope you find it helpful. If you liked this article, then please share and comment.

This Article is TAGGED in , , , , , , . BOOKMARK THE permalink.

Avatar photo
Chintan Upadhayay
I am a senior web developer with more than 4+ years experience in WordPress, PHP, MySQL, HTML, CSS, jQuery and other web technologies. I am the beginner in SharePoint and Learning SharePoint.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">